Commit Graph
101 Commits
Author SHA1 Message Date
James Newton-King 306c3a812b Merge pull request #1125 from JonHanna/null_propogate
Use null-propogation where applicable and useful.
2017-01-05 11:15:49 +13:00
stakx 8639ac94ae Typos
Running a spell checker on the whole solution revealed a couple more
typos. This fixes all of those (although internal // line comments are
mostly left alone).

Additionally, convert a very few string.Format occurrences to the pre-
dominant .FormatWith pattern and fix some incorrect message strings.
2017-01-04 03:01:26 +01:00
Jon Hanna b567a066e6 Use null-propogation where applicable and useful.
Primarily where it means one fewer field-access or simplifies
event delegate invocation, though one or two cases have just the
lesser advantage of allowing an IL stack dup rather than local access.
2017-01-03 20:08:12 +00:00
stakx 1eb391c147 Replace "stream" in reader/writer classes' comments
XML documentation comments for JsonReader, JsonWriter and derived
classes often mention "underlying streams". In most cases however,
these types don't operate directly on Streams, but through other types
such as TextReader and TextWriter.

This commit changes these comments to reflect more accurately what
kind of objects the various JSON reader / writer classes operate on.

Additionally the effect of JsonReader.CloseInput and JsonWriter.Close-
Output is made more explicit in the comments for the Close methods.
2016-12-24 02:26:16 +01:00
stakx e19ac3f28c Add & fix crefs in XML document comments
* Add references to types where they are missing.

 * Fix incorrect references to closed generic types.

 * Convert member ID strings to proper references where they can be
   converted without breaking the build. The remaining member ID
   strings usually mean that the comment would have to be rephrased
   for at least one build target / platform.

 * Drop namespaces from type names where they are unnecessary.

 * Fix the odd typo and add additional <c> markup in a few places.
2016-12-23 16:15:24 +01:00
stakx 067768a658 Fix minor issues in XML documentation comments
This fixes several minor issues in the code's documentation comments,
such as spelling errors, missing punctuation and references to other
code elements, and a few other small inconsistencies.
2016-12-10 22:53:40 +01:00
James Newton-King d7125908ca -Merge 2016-09-17 17:15:35 +12:00
James Newton-King ca27a0fc3a -Added TypeNameAssemblyFormatHandling
-Added TypeNameAssemblyFormatHandling properties to JsonSerializer and JsonSerializerSettings
-Changed TypeNameAssemblyFormat properties on JsonSerializer and JsonSerializerSettings to obsolete
2016-09-17 15:57:03 +12:00
James Newton-King 4f8a22594f -Added ISerializationBinder
-Added SerializationBinder properties to JsonSerializer and JsonSerializerSettings
-Changed Binder properties on JsonSerializer and JsonSerializerSettings to obsolete
2016-09-16 16:10:13 +12:00
James Newton-King ce2a08dba2 -Formatting 2015-12-27 14:31:36 +13:00
Jon Hanna 7e6194b61b Use GetValueOrDefault() over Value when Nullable<T> known non-null
GetValueOrDefault() is an easily-inlined access to a field as this
will hold the correct value for both HasValue and !HasValue cases.
The Value property in comparison contains a branch on a check that the
Nullable<T> has its internal hasValue flag to decide whether to throw
InvalidOperationException or not.

Hence when a nullable type is known to have a value (not be null) and
one wants the value, rather than to possibly trigger the exception-throw
GetValueOrDefault() has a slight performance benefit over Value.

Accordingly, replace calls to the Value property with calls to
GetValueOrDefault() when previous checks or assignments guarantee the
value is not null.
2015-12-15 19:15:58 +00:00
James Newton-King 60cce16d43 -Documentation 2015-12-13 20:40:33 +13:00
James Newton-King 815b283e58 -Refactored buffer pool 2015-12-13 15:40:37 +13:00
James Newton-King eb0cbd6a75 -Formatting
-Build
2015-12-04 23:54:38 +13:00
James Newton-King a3193a9523 -Documentation 2015-10-03 15:12:14 +13:00
James Newton-King 1bad45e686 Merge branch 'patch-1' of https://github.com/VictorNicollet/Newtonsoft.Json into VictorNicollet-patch-1 2015-10-03 15:05:40 +13:00
James Newton-King 3cc797c240 -Added EqualityComparer to JsonSerializer 2015-06-14 13:40:06 +12:00
James Newton-King 0f584a6d52 -Added JsonRequiredProperty
-Added JsonSerializerSettings.ReferenceResolverProvider property
-Marked JsonSerializerSettings.ReferenceResolver as obsolete
2015-05-02 19:40:44 +12:00
Victor Nicollet dae51ad7ac Document the meaning of "default settings"
The term "default settings" did not obviously reference the `JsonConvert.DefaultSettings` global variable (especially to those who were not aware of its existence), and so the actual difference between `Create()` and `CreateDefault()` was unclear. By referencing it explicitly, the code, and therefore its generated documentation, will be clearer.
2015-04-08 11:45:41 +02:00
James Newton-King 20f66cdac9 -Fixed incorrect JTokenReader.Path in certain situations 2015-02-15 13:54:08 +13:00
James Newton-King 1337c4f7f7 -Performance 2014-09-28 16:19:18 +13:00
James Newton-King e32b4671c8 -Added MetadataPropertyHandling.Ignore 2014-07-20 18:29:31 +12:00
James Newton-King c987b0509a -Fixed JsonConvert.PopulateObject not setting JsonReader settings 2014-06-15 15:04:17 +12:00
James Newton-King 2039a29d91 -Rename SpecialPropertyHandling to MetadataPropertyHandling 2014-04-27 15:05:22 +12:00
James Newton-King 35fc7ed0f4 -Added support for DateFormatString when reading JSON 2014-04-26 13:03:04 +12:00
James Newton-King 0f77cd1b03 -Added SpecialPropertiesHandling 2014-02-12 01:43:46 +13:00
James Newton-King bcd6982419 -Code reformat 2013-10-20 15:08:39 +13:00
James Newton-King f68794d206 -Added serialized/deserialized JSON when verbose tracing
-Fixed not using default serializer settings with primitive values and JToken.ToObject
-Fixed error writing BigIntegers with JsonWriter.WriteToken
2013-05-19 22:34:21 +12:00
James Newton-King 6f2b931a90 -Fixed deserializing Regex when using StringEnumConverter
-Fixed serializing and deserializing typed DataSets
2013-05-04 15:28:01 +12:00
James Newton-King 64da81d386 -Added JsonDataExtensionAttribute 2013-04-30 00:13:20 +12:00
James Newton-King a7d47558d8 -Added default serializer settings 2013-04-28 12:27:47 +12:00
James Newton-King b6d3168ed8 -Refactored parsing dates
-Refactored writing integers
-Refactored JsonConvert
2013-04-21 18:27:08 +12:00
James Newton-King 70f5a1dced -Added FloatParseHandling
-Fixed build
2013-03-26 21:53:28 +13:00
James Newton-King 787bde6e15 -Tests
-XML documentation
-Removed generic serialize methods
2013-03-24 14:49:54 +13:00
James Newton-King f9fa0b00e7 -Added DeserializeAnonymousType overload with JsonSerializerSettings
-Added support for specifying the root type when serialize JSON to use with TypeNameHandling.Auto
-Fixed recursively reading type wrapper objects when deserializing
2013-02-23 22:09:51 -08:00
James Newton-King 01c3d48ecf -Change FloatFormatHandling.Zero to DefaultValue
-Documentation
2013-02-09 23:17:05 +13:00
James Newton-King 0db89bf5fa -Added FloatFormatHandling to JsonWriter/JsonSerializer/JsonSerializerSettings
-Added DateFormatString to JsonWriter/JsonSerializer/JsonSerializerSettings
-Changed StringEnumConverter to convert an empty string to null for nullable enums
-Changed NaN and Infinity floating point values to be serialized as strings by default
2013-02-02 14:55:28 +13:00
James Newton-King 89883dc57b -Added ITraceWriter
-Fixed .NET 2.0 build using DateTimeOffset
2012-11-09 17:10:32 +13:00
James Newton-King e2a0191ee5 -Fixed exception message typo
-Fixed serializer sometimes not using DateParseHandling setting
-Fixed error in JsonWriter.WriteToken when writing a DateTimeOffset
-Fixed error when serializing emitted classes that have a constructor with null named parameters (really?)
2012-10-02 21:54:10 +13:00
James Newton-King 2320d2d55e -Remove IgnoreAll and move fix to Ignore 2012-09-01 14:08:11 +12:00
James Newton-King d9c8d78d77 -Added IgnoreAll to DefaultValueHandling which ignores all default class/struct/privative values
-Added support for DataMemberAttribute's EmitDefaultValue
-Fixed losing decimal precision when writing JValues
-Fixed error when calling ToList on empty JObjects and JArrays
2012-09-01 13:34:07 +12:00
James Newton-King aef0759038 -Fixed deserializer attempting to populate JSON onto an object that was created with a non-default constructor
-Added GetResolvedPropertyName to DefaultContractResolver
2012-05-27 21:29:02 +12:00
James Newton-King bdc73900b5 -Added CheckAdditionalContent to JsonSerializer/JsonSerializerSettings
-Fixed bad JSON in an array with error handling creating an infinite loop
-JsonTextReader no longer returns no content after consecutive underlying content read failures
2012-05-17 15:27:26 +12:00
James Newton-King 852a980659 -Added DateParseHandling 2012-04-19 00:02:11 +12:00
James Newton-King 11310fdf05 -Incremented version to 4.5.2
-Fixed failing turkey test
-XML documentation
2012-04-11 18:39:43 +12:00
James Newton-King e3cec969ef -Added support for Serializable attribute and MemberSerialization.Fields
-Added support for ignoring properties with NonSerializable attribute
-Added MaxDepth to JsonReader/JsonSerializer/JsonSerializerSettings
2012-04-08 19:33:09 +12:00
James Newton-King 83618b1ea0 -Line endings 2012-04-08 18:10:07 +12:00
James Newton-King f8a13d7aa3 -Xml documentation 2012-03-05 19:30:14 +13:00
James Newton-King fd760e3389 -Added DateFormatHandling to control whether dates are written in the MS format or ISO format, with ISO as the default
-Added DateTimeZoneHandling to control reading and writing DateTime time zone details
-Added reader/writer specific Formatting, DateFormatHandling and DateTimeZoneHandling to JsonSerializerSettings
-Added feature of reader/writer specific settings to be set on JsonReader/JsonWriter when serializing
-Added ReadAsDate to JsonReader
-Added ReadAsString to JsonReader
-Changed JsonTextReader to automatically read ISO strings as dates
-Refactored ReadAsXXX methods and reduce code redundancy
-Removed unused JsonDateTimeSerializationMode
2012-03-04 18:10:20 +06:00
JamesNK 90297804e1 -Performance improvements 2012-01-08 00:54:53 +00:00