From 2097219ec9183e7cf6db28be57bf521f5148fa16 Mon Sep 17 00:00:00 2001
From: James Newton-King
Date: Sun, 22 Jul 2012 14:51:15 +1200
Subject: [PATCH] -Fixed bugs and made improvements to help
---
Doc/ContractResolver.aml | 8 +-
Doc/ConvertingJSONandXML.aml | 21 ++++-
Doc/CustomCreationConverter.aml | 9 +-
Doc/DatesInJSON.aml | 12 ++-
Doc/Introduction.aml | 31 +++++++
Doc/LINQtoJSON.aml | 14 ++-
Doc/PreserveObjectReferences.aml | 5 +-
Doc/ReadingWritingJSON.aml | 10 ++-
Doc/ReducingSerializedJSONSize.aml | 6 ++
Doc/SelectToken.aml | 9 ++
Doc/SerializationAttributes.aml | 7 ++
Doc/SerializationCallbacks.aml | 22 ++---
Doc/SerializationErrorHandling.aml | 9 ++
Doc/SerializationGuide.aml | 23 ++++-
Doc/SerializationSettings.aml | 25 +++++-
Doc/SerializingCollections.aml | 4 +
Doc/SerializingJSON.aml | 30 ++++++-
Doc/SerializingJSONFragments.aml | 8 ++
Doc/doc.content | 4 +-
Doc/doc.shfbproj | 89 ++++++++++---------
.../ConvertingJsonAndXmlTests.cs | 46 ++++++++++
.../Documentation/SerializationTests.cs | 88 +++++++++---------
22 files changed, 358 insertions(+), 122 deletions(-)
diff --git a/Doc/ContractResolver.aml b/Doc/ContractResolver.aml
index 898ec208..cd31ee1d 100644
--- a/Doc/ContractResolver.aml
+++ b/Doc/ContractResolver.aml
@@ -7,7 +7,8 @@
-->
- The IContractResolver interface provides a way to customize how the
+ The T:Newtonsoft.Json.Serialization.IContractResolver
+ interface provides a way to customize how the
JsonSerializer serializes and deserializes .NET objects to JSON.
Implementing the IContractResolver interface and then assigning an
instance to a JsonSerializer lets you control whether the object is
@@ -44,5 +45,10 @@
+
+ T:Newtonsoft.Json.Serialization.IContractResolver
+ T:Newtonsoft.Json.Serialization.DefaultContractResolver
+ T:Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver
+
\ No newline at end of file
diff --git a/Doc/ConvertingJSONandXML.aml b/Doc/ConvertingJSONandXML.aml
index 87a5f246..7312b80a 100644
--- a/Doc/ConvertingJSONandXML.aml
+++ b/Doc/ConvertingJSONandXML.aml
@@ -24,6 +24,12 @@
Empty elements are null.
+
+ The version of Json.NET being used in your application will change what XML conversion methods are available.
+ SerializeXmlNode/DeserializeXmlNode are available when the framework supports XmlDocument,
+ SerializeXNode/DeserializeXNode are available when the framework supports XDocument.
+
+
@@ -36,7 +42,16 @@
-
+ Because multiple nodes with a the same name at the same level are grouped together into an array
+ the convernsion process can produce different JSON depending on the number of nodes. For example if some
+ XML for a user has a single <Role> node then that role will be text against
+ a JSON "Role" property, but if the user has multiple <Role>
+ nodes then the role values will be placed in a JSON array.
+
+ To fix this situation a custom XML attribute can be added to force a JSON array to be created.
+
+
+
DeserializeXmlNode
@@ -55,5 +70,9 @@
+
+ T:Newtonsoft.Json.Converters.XmlNodeConverter
+ T:Newtonsoft.Json.JsonConvert
+
\ No newline at end of file
diff --git a/Doc/CustomCreationConverter.aml b/Doc/CustomCreationConverter.aml
index 3b4bc87b..065d678a 100644
--- a/Doc/CustomCreationConverter.aml
+++ b/Doc/CustomCreationConverter.aml
@@ -7,14 +7,12 @@
-->
- The CustomCreationConverter is a JsonConverter that provides a way
+ The T:Newtonsoft.Json.Converters.CustomCreationConverter`1
+ is a JsonConverter that provides a way
to customize how an object is created during JSON deserialization. Once
the object has been created it will then have values populated onto it by
the serializer.
-
Example
@@ -25,5 +23,8 @@
+
+ T:Newtonsoft.Json.Converters.CustomCreationConverter`1
+
\ No newline at end of file
diff --git a/Doc/DatesInJSON.aml b/Doc/DatesInJSON.aml
index fc122a9d..f92a721f 100644
--- a/Doc/DatesInJSON.aml
+++ b/Doc/DatesInJSON.aml
@@ -28,9 +28,9 @@
ISO 8601 standard
http://en.wikipedia.org/wiki/ISO_8601
_blank
-: 2012-03-19T07:22Z.
+: "2012-03-19T07:22Z".
Prior to Json.NET 4.5 dates were written using the Microsoft
- format: "\/Date(1198908717056)\/". If you want to use this format, or
+ format: "\/Date(1198908717056)\/". If you want to use this format, or
you want to maintain compatibility with Microsoft JSON serializers or
older versions of Json.NET then change the
T:Newtonsoft.Json.DateFormatHandling
@@ -76,7 +76,7 @@
IsoDateTimeConverter
- Since Json.NET 4.5 dates are written using the ISO 8601
+ From Json.NET 4.5 and onwards dates are written using the ISO 8601
format by default and using this converter is unnecessary.
IsoDateTimeConverter seralizes a DateTime to an
@@ -89,5 +89,11 @@
further customize the formatted string.
+
+ T:Newtonsoft.Json.DateFormatHandling
+ T:Newtonsoft.Json.DateTimeZoneHandling
+ T:Newtonsoft.Json.Converters.JavaScriptDateTimeConverter
+ T:Newtonsoft.Json.Converters.IsoDateTimeConverter
+
\ No newline at end of file
diff --git a/Doc/Introduction.aml b/Doc/Introduction.aml
index 006480a9..b082b756 100644
--- a/Doc/Introduction.aml
+++ b/Doc/Introduction.aml
@@ -43,6 +43,25 @@ and write from your objects.
+
+ Getting Started
+
+
+
+
+Serializing and Deserializing JSON
+SerializingJSON.htm
+_self
+
+
+LINQ to JSON
+LINQtoJSON.htm
+_self
+
+
+
+
+
History
Json.NET grew out of projects I was working on in late 2005 involving JavaScript,
@@ -87,6 +106,18 @@ and write from your objects.
+
+
+ Serializing and Deserializing JSON
+ SerializingJSON.htm
+ _self
+
+
+ LINQ to JSON
+ LINQtoJSON.htm
+ _self
+
+
\ No newline at end of file
diff --git a/Doc/LINQtoJSON.aml b/Doc/LINQtoJSON.aml
index 09be4a8d..decfa80c 100644
--- a/Doc/LINQtoJSON.aml
+++ b/Doc/LINQtoJSON.aml
@@ -46,8 +46,7 @@
objects are
M:Newtonsoft.Json.Linq.JToken.Children
and
- P:Newtonsoft.Json.Linq.JToken.Item(System.Object)
- .
+ P:Newtonsoft.Json.Linq.JToken.Item(System.Object).
Children returns all the children of that object. If it is a
JObject it will return a collection of properties to work with and if
@@ -68,5 +67,16 @@
+
+
+ Querying LINQ to JSON with SelectToken
+ SelectToken.htm
+ _self
+
+
+ T:Newtonsoft.Json.Linq.JObject
+ T:Newtonsoft.Json.Linq.JArray
+ T:Newtonsoft.Json.Linq.JValue
+
\ No newline at end of file
diff --git a/Doc/PreserveObjectReferences.aml b/Doc/PreserveObjectReferences.aml
index 77e08e6e..638b8945 100644
--- a/Doc/PreserveObjectReferences.aml
+++ b/Doc/PreserveObjectReferences.aml
@@ -27,7 +27,7 @@
PreserveReferencesHandling
- Settings PreserveReferencesHandling will track object references
+ Setting T:Newtonsoft.Json.PreserveReferencesHandling will track object references
when serializing and deserializing JSON.
@@ -68,5 +68,8 @@
the JsonSerializer.
+
+ T:Newtonsoft.Json.PreserveReferencesHandling
+
\ No newline at end of file
diff --git a/Doc/ReadingWritingJSON.aml b/Doc/ReadingWritingJSON.aml
index 605f368a..d92c0918 100644
--- a/Doc/ReadingWritingJSON.aml
+++ b/Doc/ReadingWritingJSON.aml
@@ -5,7 +5,7 @@
To manually read and write JSON Json.NET provides the
T:Newtonsoft.Json.JsonReader
and
- T:Newtonsoft.Json.JsonWriter classes.
+ T:Newtonsoft.Json.JsonWriter classes. These are low level classes and used internally by Json.NET.
JsonTextReader and JsonTextWriter
@@ -33,5 +33,13 @@
+
+ T:Newtonsoft.Json.JsonReader
+ T:Newtonsoft.Json.JsonWriter
+ T:Newtonsoft.Json.Linq.JTokenReader
+ T:Newtonsoft.Json.Linq.JTokenWriter
+ T:Newtonsoft.Json.Bson.BsonReader
+ T:Newtonsoft.Json.Bson.BsonWriter
+
\ No newline at end of file
diff --git a/Doc/ReducingSerializedJSONSize.aml b/Doc/ReducingSerializedJSONSize.aml
index df4b60e7..9cbe0698 100644
--- a/Doc/ReducingSerializedJSONSize.aml
+++ b/Doc/ReducingSerializedJSONSize.aml
@@ -123,5 +123,11 @@
+
+ T:Newtonsoft.Json.Formatting
+ T:Newtonsoft.Json.JsonIgnoreAttribute
+ T:Newtonsoft.Json.DefaultValueHandling
+ T:Newtonsoft.Json.NullValueHandling
+
\ No newline at end of file
diff --git a/Doc/SelectToken.aml b/Doc/SelectToken.aml
index f9396b2c..28207058 100644
--- a/Doc/SelectToken.aml
+++ b/Doc/SelectToken.aml
@@ -33,5 +33,14 @@
+
+
+ LINQ to JSON
+ LINQtoJSON.htm
+ _self
+
+
+ Overload:Newtonsoft.Json.Linq.JToken.SelectToken
+
\ No newline at end of file
diff --git a/Doc/SerializationAttributes.aml b/Doc/SerializationAttributes.aml
index 89e6361b..91bf708b 100644
--- a/Doc/SerializationAttributes.aml
+++ b/Doc/SerializationAttributes.aml
@@ -134,5 +134,12 @@
+
+ T:Newtonsoft.Json.JsonObjectAttribute
+ T:Newtonsoft.Json.JsonArrayAttribute
+ T:Newtonsoft.Json.JsonDictionaryAttribute
+ T:Newtonsoft.Json.JsonPropertyAttribute
+ T:Newtonsoft.Json.JsonConverterAttribute
+
\ No newline at end of file
diff --git a/Doc/SerializationCallbacks.aml b/Doc/SerializationCallbacks.aml
index 6e7b917c..7ede501f 100644
--- a/Doc/SerializationCallbacks.aml
+++ b/Doc/SerializationCallbacks.aml
@@ -47,22 +47,12 @@ serialization lifecycle, decorate a method with the appropraite attribute
-
+
+ T:System.Runtime.Serialization.OnSerializingAttribute
+ T:System.Runtime.Serialization.OnSerializedAttribute
+ T:System.Runtime.Serialization.OnDeserializingAttribute
+ T:System.Runtime.Serialization.OnDeserializedAttribute
+
\ No newline at end of file
diff --git a/Doc/SerializationErrorHandling.aml b/Doc/SerializationErrorHandling.aml
index cc09f47e..5ed03358 100644
--- a/Doc/SerializationErrorHandling.aml
+++ b/Doc/SerializationErrorHandling.aml
@@ -94,5 +94,14 @@
+
+
+ Serialization Attributes
+ SerializationAttributes.htm
+ _self
+
+ E:Newtonsoft.Json.JsonSerializer.Error
+ T:Newtonsoft.Json.Serialization.OnErrorAttribute
+
\ No newline at end of file
diff --git a/Doc/SerializationGuide.aml b/Doc/SerializationGuide.aml
index 004fa430..f05286ee 100644
--- a/Doc/SerializationGuide.aml
+++ b/Doc/SerializationGuide.aml
@@ -282,7 +282,26 @@
-
-
+
+
+
+ Serialization Settings
+ SerializationSettings.htm
+ _self
+
+
+ Serialization Attributes
+ SerializationAttributes.htm
+ _self
+
+
+ Serializing Dates in JSON
+ DatesInJSON.htm
+ _self
+
+
+ T:Newtonsoft.Json.JsonSerializer
+ T:Newtonsoft.Json.JsonSerializerSettings
+
\ No newline at end of file
diff --git a/Doc/SerializationSettings.aml b/Doc/SerializationSettings.aml
index 527c536f..9a55e06d 100644
--- a/Doc/SerializationSettings.aml
+++ b/Doc/SerializationSettings.aml
@@ -7,7 +7,8 @@
-->
- JsonSerializer has a number of properties on it to customize how it serializes JSON. These can also be used with the methods on JsonConvert via the JsonSerializerSettings overloads.
+ JsonSerializer has a number of properties on it to customize how it serializes JSON. These can also be used
+ with the methods on JsonConvert via the T:Newtonsoft.Json.JsonSerializerSettings overloads.
-
-
+
+
+ Serialization Guide
+ SerializationGuide.htm
+ _self
+
+
+ Serialization Attributes
+ SerializationAttributes.htm
+ _self
+
+
+ Serializing Dates in JSON
+ DatesInJSON.htm
+ _self
+
+
+ T:Newtonsoft.Json.JsonSerializer
+ T:Newtonsoft.Json.JsonSerializerSettings
+
\ No newline at end of file
diff --git a/Doc/SerializingCollections.aml b/Doc/SerializingCollections.aml
index 46101c26..79f12f15 100644
--- a/Doc/SerializingCollections.aml
+++ b/Doc/SerializingCollections.aml
@@ -53,5 +53,9 @@
+
+ T:Newtonsoft.Json.JsonConvert
+ T:Newtonsoft.Json.JsonSerializer
+
\ No newline at end of file
diff --git a/Doc/SerializingJSON.aml b/Doc/SerializingJSON.aml
index df2d5a89..ac51e76e 100644
--- a/Doc/SerializingJSON.aml
+++ b/Doc/SerializingJSON.aml
@@ -16,8 +16,8 @@
JsonConvert
For simple scenarios where you want to convert to and from a JSON string the
- M:Newtonsoft.Json.JsonConvert.SerializeObject(System.Object,Newtonsoft.Json.Formatting) and
- M:Newtonsoft.Json.JsonConvert.DeserializeObject``1(System.String,Newtonsoft.Json.JsonSerializerSettings)
+ Overload:Newtonsoft.Json.JsonConvert.SerializeObject and
+ Overload:Newtonsoft.Json.JsonConvert.DeserializeObject
methods on JsonConvert provide an easy to use wrapper over JsonSerializer.
@@ -52,5 +52,31 @@ LINQ to JSON objects or
+
+
+ Serialization Guide
+ SerializationGuide.htm
+ _self
+
+
+ Serialization Settings
+ SerializationSettings.htm
+ _self
+
+
+ Serialization Attributes
+ SerializationAttributes.htm
+ _self
+
+
+ Serializing Partial JSON Fragments
+ SerializingJSONFragments.htm
+ _self
+
+
+ T:Newtonsoft.Json.JsonConvert
+ T:Newtonsoft.Json.JsonSerializer
+ T:Newtonsoft.Json.JsonSerializerSettings
+
\ No newline at end of file
diff --git a/Doc/SerializingJSONFragments.aml b/Doc/SerializingJSONFragments.aml
index d307083b..42b40bab 100644
--- a/Doc/SerializingJSONFragments.aml
+++ b/Doc/SerializingJSONFragments.aml
@@ -15,5 +15,13 @@
+
+ T:Newtonsoft.Json.JsonReader
+ T:Newtonsoft.Json.JsonWriter
+ T:Newtonsoft.Json.Linq.JTokenReader
+ T:Newtonsoft.Json.Linq.JTokenWriter
+ T:Newtonsoft.Json.Bson.BsonReader
+ T:Newtonsoft.Json.Bson.BsonWriter
+
\ No newline at end of file
diff --git a/Doc/doc.content b/Doc/doc.content
index cadaab66..ce0c7870 100644
--- a/Doc/doc.content
+++ b/Doc/doc.content
@@ -7,7 +7,7 @@
-
+
@@ -18,6 +18,6 @@
-
+
\ No newline at end of file
diff --git a/Doc/doc.shfbproj b/Doc/doc.shfbproj
index 81d7d1c8..4a9ea64c 100644
--- a/Doc/doc.shfbproj
+++ b/Doc/doc.shfbproj
@@ -73,49 +73,58 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
False