-Fixed bugs and made improvements to help
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
</summary>
|
||||
-->
|
||||
<introduction>
|
||||
<para>The IContractResolver interface provides a way to customize how the
|
||||
<para>The <codeEntityReference>T:Newtonsoft.Json.Serialization.IContractResolver</codeEntityReference>
|
||||
interface provides a way to customize how the
|
||||
JsonSerializer serializes and deserializes .NET objects to JSON.</para>
|
||||
<para>Implementing the IContractResolver interface and then assigning an
|
||||
instance to a JsonSerializer lets you control whether the object is
|
||||
@@ -44,5 +45,10 @@
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="ContractResolver" title="ContractResolver" />
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Serialization.IContractResolver</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Serialization.DefaultContractResolver</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -24,6 +24,12 @@
|
||||
<listItem><para>Empty elements are null.</para></listItem>
|
||||
</list>
|
||||
|
||||
<alert class="note">
|
||||
<para>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.</para>
|
||||
</alert>
|
||||
|
||||
</content>
|
||||
</section>
|
||||
<section>
|
||||
@@ -36,7 +42,16 @@
|
||||
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\ConvertingJsonAndXmlTests.cs" region="SerializeXmlNode" title="Converting XML to JSON with SerializeXmlNode" />
|
||||
|
||||
</content>
|
||||
<para>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 <codeInline><Role></codeInline> node then that role will be text against
|
||||
a JSON <codeInline>"Role"</codeInline> property, but if the user has multiple <codeInline><Role></codeInline>
|
||||
nodes then the role values will be placed in a JSON array.</para>
|
||||
|
||||
<para>To fix this situation a custom XML attribute can be added to force a JSON array to be created.</para>
|
||||
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\ConvertingJsonAndXmlTests.cs" region="ForceJsonArray" title="Attribute to Force a JSON Array" />
|
||||
</content>
|
||||
</section>
|
||||
<section>
|
||||
<title>DeserializeXmlNode</title>
|
||||
@@ -55,5 +70,9 @@
|
||||
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Converters.XmlNodeConverter</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonConvert</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -7,14 +7,12 @@
|
||||
</summary>
|
||||
-->
|
||||
<introduction>
|
||||
<para>The CustomCreationConverter is a JsonConverter that provides a way
|
||||
<para>The <codeEntityReference>T:Newtonsoft.Json.Converters.CustomCreationConverter`1</codeEntityReference>
|
||||
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.</para>
|
||||
</introduction>
|
||||
<!-- Add one or more top-level section elements. These are collapsible.
|
||||
If using <autoOutline />, add an address attribute to identify it
|
||||
and specify a title so that it can be jumped to with a hyperlink. -->
|
||||
<section>
|
||||
<title>Example</title>
|
||||
<content>
|
||||
@@ -25,5 +23,8 @@
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="CustomCreationConverterExample" title="CustomCreationConverter Example" />
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Converters.CustomCreationConverter`1</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
+9
-3
@@ -28,9 +28,9 @@
|
||||
<linkText>ISO 8601 standard</linkText>
|
||||
<linkUri>http://en.wikipedia.org/wiki/ISO_8601</linkUri>
|
||||
<linkTarget>_blank</linkTarget>
|
||||
</externalLink>: 2012-03-19T07:22Z.</para>
|
||||
</externalLink>: <codeInline>"2012-03-19T07:22Z"</codeInline>.</para>
|
||||
<para>Prior to Json.NET 4.5 dates were written using the Microsoft
|
||||
format: "\/Date(1198908717056)\/". If you want to use this format, or
|
||||
format: <codeInline>"\/Date(1198908717056)\/"</codeInline>. 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
|
||||
<codeEntityReference>T:Newtonsoft.Json.DateFormatHandling</codeEntityReference>
|
||||
@@ -76,7 +76,7 @@
|
||||
<title>IsoDateTimeConverter</title>
|
||||
<content>
|
||||
<alert class="note">
|
||||
<para>Since Json.NET 4.5 dates are written using the ISO 8601
|
||||
<para>From Json.NET 4.5 and onwards dates are written using the ISO 8601
|
||||
format by default and using this converter is unnecessary.</para>
|
||||
</alert>
|
||||
<para>IsoDateTimeConverter seralizes a DateTime to an <externalLink>
|
||||
@@ -89,5 +89,11 @@
|
||||
further customize the formatted string.</para>
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:Newtonsoft.Json.DateFormatHandling</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.DateTimeZoneHandling</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Converters.JavaScriptDateTimeConverter</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Converters.IsoDateTimeConverter</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -43,6 +43,25 @@ and write from your objects.</para>
|
||||
</content>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Getting Started</title>
|
||||
<content>
|
||||
|
||||
<list class="bullet">
|
||||
<listItem><para><externalLink>
|
||||
<linkText>Serializing and Deserializing JSON</linkText>
|
||||
<linkUri>SerializingJSON.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink></para></listItem>
|
||||
<listItem><para><externalLink>
|
||||
<linkText>LINQ to JSON</linkText>
|
||||
<linkUri>LINQtoJSON.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink></para></listItem>
|
||||
</list>
|
||||
|
||||
</content>
|
||||
</section>
|
||||
<section>
|
||||
<title>History</title>
|
||||
<content><para>Json.NET grew out of projects I was working on in late 2005 involving JavaScript,
|
||||
@@ -87,6 +106,18 @@ and write from your objects.</para>
|
||||
</a>
|
||||
</p>
|
||||
</markup>
|
||||
<relatedTopics>
|
||||
<externalLink>
|
||||
<linkText>Serializing and Deserializing JSON</linkText>
|
||||
<linkUri>SerializingJSON.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
<externalLink>
|
||||
<linkText>LINQ to JSON</linkText>
|
||||
<linkUri>LINQtoJSON.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
</relatedTopics>
|
||||
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
+12
-2
@@ -46,8 +46,7 @@
|
||||
objects are
|
||||
<codeEntityReference>M:Newtonsoft.Json.Linq.JToken.Children</codeEntityReference>
|
||||
and
|
||||
<codeEntityReference>P:Newtonsoft.Json.Linq.JToken.Item(System.Object)</codeEntityReference>
|
||||
.</para>
|
||||
<codeEntityReference>P:Newtonsoft.Json.Linq.JToken.Item(System.Object)</codeEntityReference>.</para>
|
||||
|
||||
<para>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 @@
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonDeserializeExample" title="Deserializing Using LINQ Example" />
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<externalLink>
|
||||
<linkText>Querying LINQ to JSON with SelectToken</linkText>
|
||||
<linkUri>SelectToken.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
|
||||
<codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Linq.JArray</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Linq.JValue</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -27,7 +27,7 @@
|
||||
<section>
|
||||
<title>PreserveReferencesHandling</title>
|
||||
<content>
|
||||
<para>Settings PreserveReferencesHandling will track object references
|
||||
<para>Setting <codeEntityReference>T:Newtonsoft.Json.PreserveReferencesHandling</codeEntityReference> will track object references
|
||||
when serializing and deserializing JSON.</para>
|
||||
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="PreservingObjectReferencesOn" title="Preserve Object References On" />
|
||||
@@ -68,5 +68,8 @@
|
||||
the JsonSerializer.</para>
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:Newtonsoft.Json.PreserveReferencesHandling</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -5,7 +5,7 @@
|
||||
<para>To manually read and write JSON Json.NET provides the
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonReader</codeEntityReference>
|
||||
and
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonWriter</codeEntityReference> classes.</para>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonWriter</codeEntityReference> classes. These are low level classes and used internally by Json.NET.</para>
|
||||
</introduction>
|
||||
<section>
|
||||
<title>JsonTextReader and JsonTextWriter</title>
|
||||
@@ -33,5 +33,13 @@
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\ReadingAndWritingJsonTests.cs" region="ReadingAndWritingJsonLinq" title="Deserializing with JTokenReader" />
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonReader</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonWriter</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Linq.JTokenReader</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Linq.JTokenWriter</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Bson.BsonReader</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Bson.BsonWriter</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -123,5 +123,11 @@
|
||||
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Formatting</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonIgnoreAttribute</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.DefaultValueHandling</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.NullValueHandling</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -33,5 +33,14 @@
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="SelectTokenLinq" title="SelectToken With LINQ Example" />
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<externalLink>
|
||||
<linkText>LINQ to JSON</linkText>
|
||||
<linkUri>LINQtoJSON.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
|
||||
<codeEntityReference>Overload:Newtonsoft.Json.Linq.JToken.SelectToken</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -134,5 +134,12 @@
|
||||
</section>
|
||||
</sections>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonObjectAttribute</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonArrayAttribute</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonDictionaryAttribute</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonPropertyAttribute</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonConverterAttribute</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -47,22 +47,12 @@ serialization lifecycle, decorate a method with the appropraite attribute
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="SerializationCallbacksExample" title="Serialization Callback Example" />
|
||||
|
||||
</content>
|
||||
<!-- If a section contains a sections element, its content creates
|
||||
sub-sections. These are not collapsible.
|
||||
<sections>
|
||||
<section address="SubSection1">
|
||||
<title>Sub-section 1</title>
|
||||
<content>
|
||||
<para>Sub-section content.</para>
|
||||
</content>
|
||||
</section>
|
||||
<section address="SubSection2">
|
||||
<title>Sub-section 2</title>
|
||||
<content>
|
||||
<para>Sub-section content.</para>
|
||||
</content>
|
||||
</section>
|
||||
</sections> -->
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:System.Runtime.Serialization.OnSerializingAttribute</codeEntityReference>
|
||||
<codeEntityReference>T:System.Runtime.Serialization.OnSerializedAttribute</codeEntityReference>
|
||||
<codeEntityReference>T:System.Runtime.Serialization.OnDeserializingAttribute</codeEntityReference>
|
||||
<codeEntityReference>T:System.Runtime.Serialization.OnDeserializedAttribute</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -94,5 +94,14 @@
|
||||
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<externalLink>
|
||||
<linkText>Serialization Attributes</linkText>
|
||||
<linkUri>SerializationAttributes.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
<codeEntityReference>E:Newtonsoft.Json.JsonSerializer.Error</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Serialization.OnErrorAttribute</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -282,7 +282,26 @@
|
||||
</section>
|
||||
|
||||
</sections>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<externalLink>
|
||||
<linkText>Serialization Settings</linkText>
|
||||
<linkUri>SerializationSettings.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
<externalLink>
|
||||
<linkText>Serialization Attributes</linkText>
|
||||
<linkUri>SerializationAttributes.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
<externalLink>
|
||||
<linkText>Serializing Dates in JSON</linkText>
|
||||
<linkUri>DatesInJSON.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonSerializer</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonSerializerSettings</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -7,7 +7,8 @@
|
||||
</summary>
|
||||
-->
|
||||
<introduction>
|
||||
<para>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.</para>
|
||||
<para>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 <codeEntityReference>T:Newtonsoft.Json.JsonSerializerSettings</codeEntityReference> overloads.</para>
|
||||
</introduction>
|
||||
|
||||
<section>
|
||||
@@ -320,7 +321,25 @@
|
||||
</para>
|
||||
</content>
|
||||
</section>
|
||||
|
||||
|
||||
<relatedTopics>
|
||||
<externalLink>
|
||||
<linkText>Serialization Guide</linkText>
|
||||
<linkUri>SerializationGuide.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
<externalLink>
|
||||
<linkText>Serialization Attributes</linkText>
|
||||
<linkUri>SerializationAttributes.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
<externalLink>
|
||||
<linkText>Serializing Dates in JSON</linkText>
|
||||
<linkUri>DatesInJSON.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonSerializer</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonSerializerSettings</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -53,5 +53,9 @@
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="SerializingCollectionsDeserializingDictionaries" title="Deserializing Dictionaries" />
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonConvert</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonSerializer</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
+28
-2
@@ -16,8 +16,8 @@
|
||||
<section>
|
||||
<title>JsonConvert</title>
|
||||
<content><para>For simple scenarios where you want to convert to and from a JSON string the
|
||||
<codeEntityReference>M:Newtonsoft.Json.JsonConvert.SerializeObject(System.Object,Newtonsoft.Json.Formatting)</codeEntityReference> and
|
||||
<codeEntityReference>M:Newtonsoft.Json.JsonConvert.DeserializeObject``1(System.String,Newtonsoft.Json.JsonSerializerSettings)</codeEntityReference>
|
||||
<codeEntityReference>Overload:Newtonsoft.Json.JsonConvert.SerializeObject</codeEntityReference> and
|
||||
<codeEntityReference>Overload:Newtonsoft.Json.JsonConvert.DeserializeObject</codeEntityReference>
|
||||
methods on JsonConvert provide an easy to use wrapper over JsonSerializer.</para>
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="SerializeObject" title="Serializing JSON with JsonConvert" />
|
||||
<para>
|
||||
@@ -52,5 +52,31 @@ LINQ to JSON objects or
|
||||
</externalLink></para>
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<externalLink>
|
||||
<linkText>Serialization Guide</linkText>
|
||||
<linkUri>SerializationGuide.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
<externalLink>
|
||||
<linkText>Serialization Settings</linkText>
|
||||
<linkUri>SerializationSettings.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
<externalLink>
|
||||
<linkText>Serialization Attributes</linkText>
|
||||
<linkUri>SerializationAttributes.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
<externalLink>
|
||||
<linkText>Serializing Partial JSON Fragments</linkText>
|
||||
<linkUri>SerializingJSONFragments.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonConvert</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonSerializer</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonSerializerSettings</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -15,5 +15,13 @@
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="SerializingPartialJsonFragmentsExample" title="Serializing Partial JSON Fragment Example" />
|
||||
|
||||
</introduction>
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonReader</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonWriter</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Linq.JTokenReader</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Linq.JTokenWriter</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Bson.BsonReader</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Bson.BsonWriter</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
+2
-2
@@ -7,7 +7,7 @@
|
||||
<Topic id="SerializationAttributes" visible="True" title="Serialization Attributes" />
|
||||
<Topic id="SerializationCallbacks" visible="True" title="Serialization Callbacks" />
|
||||
<Topic id="SerializationErrorHandling" visible="True" title="Serialization Error Handling" />
|
||||
<Topic id="PreserveObjectReferences" visible="True" isSelected="true" title="Preserving Object Referencess" />
|
||||
<Topic id="PreserveObjectReferences" visible="True" title="Preserving Object References" />
|
||||
<Topic id="CustomCreationConverter" visible="True" />
|
||||
<Topic id="ContractResolver" visible="True" />
|
||||
<Topic id="SerializingCollections" visible="True" title="Serializing Collections" />
|
||||
@@ -18,6 +18,6 @@
|
||||
<Topic id="LINQtoJSON" visible="True" isExpanded="true" title="LINQ to JSON">
|
||||
<Topic id="SelectToken" visible="True" title="Querying LINQ to JSON with SelectToken" />
|
||||
</Topic>
|
||||
<Topic id="ReadingWritingJSON" visible="True" title="Reading and Writing JSON" />
|
||||
<Topic id="ReadingWritingJSON" visible="True" isSelected="true" title="Basic Reading and Writing JSON" />
|
||||
<Topic id="ConvertingJSONandXML" visible="True" title="Converting between JSON and XML" />
|
||||
</Topics>
|
||||
+49
-40
@@ -73,49 +73,58 @@
|
||||
<logoFile filename="D:\Development\Source\Json\Newtonsoft.Json\Doc\logo.jpg" height="0" width="0" altText="Json.NET" placement="left" alignment="left" />
|
||||
</component>
|
||||
</ComponentConfig>
|
||||
<ComponentConfig id="Code Block Component" enabled="True"><component id="Code Block Component" type="SandcastleBuilder.Components.CodeBlockComponent" assembly="{@SHFBFolder}SandcastleBuilder.Components.dll">
|
||||
<basePath value="{@HtmlEncProjectFolder}" />
|
||||
<languageFilter value="true" />
|
||||
<allowMissingSource value="false" />
|
||||
<removeRegionMarkers value="false" />
|
||||
<colorizer syntaxFile="{@SHFBFolder}Colorizer\highlight.xml" styleFile="{@SHFBFolder}Colorizer\highlight.xsl" copyImageUrl="../icons/CopyCode.gif" language="cs" tabSize="0" numberLines="true" outlining="false" keepSeeTags="false" defaultTitle="true" />
|
||||
</component></ComponentConfig>
|
||||
<ComponentConfig id="Cached Reflection Index Data" enabled="True"><component id="Cached Reflection Index Data" type="SandcastleBuilder.Components.CachedCopyFromIndexComponent" assembly="{@SHFBFolder}SandcastleBuilder.Components.dll">
|
||||
<index name="reflection" value="/reflection/apis/api" key="@id" cache="10">
|
||||
<cache base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" cacheFile="{@LocalDataFolder}Cache\Reflection.cache" />
|
||||
<data files="reflection.xml" />
|
||||
</index>
|
||||
<copy name="reflection" source="*" target="/document/reference" />
|
||||
</component></ComponentConfig>
|
||||
<ComponentConfig id="Cached MSDN URL References" enabled="True"><component id="Cached MSDN URL References" type="SandcastleBuilder.Components.CachedResolveReferenceLinksComponent" assembly="{@SHFBFolder}SandcastleBuilder.Components.dll" locale="{@Locale}" linkTarget="{@SdkLinkTarget}">
|
||||
<helpOutput format="HtmlHelp1">
|
||||
<cache filename="{@LocalDataFolder}Cache\MsdnUrl.cache" />
|
||||
<targets base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" type="{@HtmlSdkLinkType}" />
|
||||
<targets files="reflection.xml" type="Local" />
|
||||
</helpOutput>
|
||||
<helpOutput format="MSHelp2">
|
||||
<cache filename="{@LocalDataFolder}Cache\MsdnUrl.cache" />
|
||||
<targets base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" type="{@MSHelp2SdkLinkType}" />
|
||||
<targets files="reflection.xml" type="Index" />
|
||||
</helpOutput>
|
||||
<helpOutput format="MSHelpViewer">
|
||||
<cache filename="{@LocalDataFolder}Cache\MsdnUrl.cache" />
|
||||
<targets base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" type="{@MSHelpViewerSdkLinkType}" />
|
||||
<targets files="reflection.xml" type="Id" />
|
||||
</helpOutput>
|
||||
<helpOutput format="Website">
|
||||
<cache filename="{@LocalDataFolder}Cache\MsdnUrl.cache" />
|
||||
<targets base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" type="{@WebsiteSdkLinkType}" />
|
||||
<targets files="reflection.xml" type="Local" />
|
||||
</helpOutput>
|
||||
</component></ComponentConfig>
|
||||
<ComponentConfig id="Cached Framework Comments Index Data" enabled="True"><component id="Cached Framework Comments Index Data" type="SandcastleBuilder.Components.CachedCopyFromIndexComponent" assembly="{@SHFBFolder}SandcastleBuilder.Components.dll">
|
||||
<index name="comments" value="/doc/members/member" key="@name" cache="100">
|
||||
<ComponentConfig id="Code Block Component" enabled="True">
|
||||
<component id="Code Block Component" type="SandcastleBuilder.Components.CodeBlockComponent" assembly="{@SHFBFolder}SandcastleBuilder.Components.dll">
|
||||
<basePath value="{@HtmlEncProjectFolder}" />
|
||||
<languageFilter value="true" />
|
||||
<allowMissingSource value="false" />
|
||||
<removeRegionMarkers value="false" />
|
||||
<colorizer syntaxFile="{@SHFBFolder}Colorizer\highlight.xml" styleFile="{@SHFBFolder}Colorizer\highlight.xsl" copyImageUrl="../icons/CopyCode.gif" language="cs" tabSize="0" numberLines="true" outlining="false" keepSeeTags="false" defaultTitle="true" />
|
||||
</component>
|
||||
</ComponentConfig>
|
||||
<ComponentConfig id="Cached Reflection Index Data" enabled="True">
|
||||
<component id="Cached Reflection Index Data" type="SandcastleBuilder.Components.CachedCopyFromIndexComponent" assembly="{@SHFBFolder}SandcastleBuilder.Components.dll">
|
||||
<index name="reflection" value="/reflection/apis/api" key="@id" cache="10">
|
||||
<cache base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" cacheFile="{@LocalDataFolder}Cache\Reflection.cache" />
|
||||
<data files="reflection.xml" />
|
||||
</index>
|
||||
<copy name="reflection" source="*" target="/document/reference" />
|
||||
</component>
|
||||
</ComponentConfig>
|
||||
<ComponentConfig id="Cached MSDN URL References" enabled="True">
|
||||
<component id="Cached MSDN URL References" type="SandcastleBuilder.Components.CachedResolveReferenceLinksComponent" assembly="{@SHFBFolder}SandcastleBuilder.Components.dll" locale="{@Locale}" linkTarget="{@SdkLinkTarget}">
|
||||
<helpOutput format="HtmlHelp1">
|
||||
<cache filename="{@LocalDataFolder}Cache\MsdnUrl.cache" />
|
||||
<targets base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" type="{@HtmlSdkLinkType}" />
|
||||
<targets files="reflection.xml" type="Local" />
|
||||
</helpOutput>
|
||||
<helpOutput format="MSHelp2">
|
||||
<cache filename="{@LocalDataFolder}Cache\MsdnUrl.cache" />
|
||||
<targets base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" type="{@MSHelp2SdkLinkType}" />
|
||||
<targets files="reflection.xml" type="Index" />
|
||||
</helpOutput>
|
||||
<helpOutput format="MSHelpViewer">
|
||||
<cache filename="{@LocalDataFolder}Cache\MsdnUrl.cache" />
|
||||
<targets base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" type="{@MSHelpViewerSdkLinkType}" />
|
||||
<targets files="reflection.xml" type="Id" />
|
||||
</helpOutput>
|
||||
<helpOutput format="Website">
|
||||
<cache filename="{@LocalDataFolder}Cache\MsdnUrl.cache" />
|
||||
<targets base="{@SandcastlePath}Data\Reflection" recurse="true" files="*.xml" type="{@WebsiteSdkLinkType}" />
|
||||
<targets files="reflection.xml" type="Local" />
|
||||
</helpOutput>
|
||||
</component>
|
||||
</ComponentConfig>
|
||||
<ComponentConfig id="Cached Framework Comments Index Data" enabled="True">
|
||||
<component id="Cached Framework Comments Index Data" type="SandcastleBuilder.Components.CachedCopyFromIndexComponent" assembly="{@SHFBFolder}SandcastleBuilder.Components.dll">
|
||||
<index name="comments" value="/doc/members/member" key="@name" cache="100">
|
||||
{@CachedFrameworkCommentList}
|
||||
{@CommentFileList}
|
||||
</index>
|
||||
<copy name="comments" source="*" target="/document/comments" />
|
||||
</component></ComponentConfig></ComponentConfigurations>
|
||||
<copy name="comments" source="*" target="/document/comments" />
|
||||
</component>
|
||||
</ComponentConfig>
|
||||
</ComponentConfigurations>
|
||||
<IndentHtml>False</IndentHtml>
|
||||
</PropertyGroup>
|
||||
<!-- There are no properties for these two groups but they need to appear in
|
||||
|
||||
@@ -132,6 +132,52 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
// </root>
|
||||
#endregion
|
||||
}
|
||||
|
||||
public void ForceJsonArray()
|
||||
{
|
||||
#region ForceJsonArray
|
||||
string xml = @"<person id='1'>
|
||||
<name>Alan</name>
|
||||
<url>http://www.google.com</url>
|
||||
<role>Admin1</role>
|
||||
</person>";
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(xml);
|
||||
|
||||
string json = JsonConvert.SerializeXmlNode(doc);
|
||||
//{
|
||||
// "person": {
|
||||
// "@id": "1",
|
||||
// "name": "Alan",
|
||||
// "url": "http://www.google.com",
|
||||
// "role": "Admin1"
|
||||
// }
|
||||
//}
|
||||
|
||||
xml = @"<person xmlns:json='http://james.newtonking.com/projects/json' id='1'>
|
||||
<name>Alan</name>
|
||||
<url>http://www.google.com</url>
|
||||
<role json:Array='true'>Admin</role>
|
||||
</person>";
|
||||
|
||||
doc = new XmlDocument();
|
||||
doc.LoadXml(xml);
|
||||
|
||||
json = JsonConvert.SerializeXmlNode(doc);
|
||||
//{
|
||||
// "person": {
|
||||
// "@id": "1",
|
||||
// "name": "Alan",
|
||||
// "url": "http://www.google.com",
|
||||
// "role": [
|
||||
// "Admin"
|
||||
// ]
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -118,58 +118,58 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SerializationCallbacksObject
|
||||
public class SerializationEventTestObject
|
||||
{
|
||||
// 2222
|
||||
// This member is serialized and deserialized with no change.
|
||||
public int Member1 { get; set; }
|
||||
#region SerializationCallbacksObject
|
||||
public class SerializationEventTestObject
|
||||
{
|
||||
// 2222
|
||||
// This member is serialized and deserialized with no change.
|
||||
public int Member1 { get; set; }
|
||||
|
||||
// The value of this field is set and reset during and
|
||||
// after serialization.
|
||||
public string Member2 { get; set; }
|
||||
// The value of this field is set and reset during and
|
||||
// after serialization.
|
||||
public string Member2 { get; set; }
|
||||
|
||||
// This field is not serialized. The OnDeserializedAttribute
|
||||
// is used to set the member value after serialization.
|
||||
[JsonIgnore]
|
||||
public string Member3 { get; set; }
|
||||
// This field is not serialized. The OnDeserializedAttribute
|
||||
// is used to set the member value after serialization.
|
||||
[JsonIgnore]
|
||||
public string Member3 { get; set; }
|
||||
|
||||
// This field is set to null, but populated after deserialization.
|
||||
public string Member4 { get; set; }
|
||||
// This field is set to null, but populated after deserialization.
|
||||
public string Member4 { get; set; }
|
||||
|
||||
public SerializationEventTestObject()
|
||||
{
|
||||
Member1 = 11;
|
||||
Member2 = "Hello World!";
|
||||
Member3 = "This is a nonserialized value";
|
||||
Member4 = null;
|
||||
}
|
||||
public SerializationEventTestObject()
|
||||
{
|
||||
Member1 = 11;
|
||||
Member2 = "Hello World!";
|
||||
Member3 = "This is a nonserialized value";
|
||||
Member4 = null;
|
||||
}
|
||||
|
||||
[OnSerializing]
|
||||
internal void OnSerializingMethod(StreamingContext context)
|
||||
{
|
||||
Member2 = "This value went into the data file during serialization.";
|
||||
}
|
||||
[OnSerializing]
|
||||
internal void OnSerializingMethod(StreamingContext context)
|
||||
{
|
||||
Member2 = "This value went into the data file during serialization.";
|
||||
}
|
||||
|
||||
[OnSerialized]
|
||||
internal void OnSerializedMethod(StreamingContext context)
|
||||
{
|
||||
Member2 = "This value was reset after serialization.";
|
||||
}
|
||||
[OnSerialized]
|
||||
internal void OnSerializedMethod(StreamingContext context)
|
||||
{
|
||||
Member2 = "This value was reset after serialization.";
|
||||
}
|
||||
|
||||
[OnDeserializing]
|
||||
internal void OnDeserializingMethod(StreamingContext context)
|
||||
{
|
||||
Member3 = "This value was set during deserialization";
|
||||
}
|
||||
[OnDeserializing]
|
||||
internal void OnDeserializingMethod(StreamingContext context)
|
||||
{
|
||||
Member3 = "This value was set during deserialization";
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
internal void OnDeserializedMethod(StreamingContext context)
|
||||
{
|
||||
Member4 = "This value was set after deserialization.";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
[OnDeserialized]
|
||||
internal void OnDeserializedMethod(StreamingContext context)
|
||||
{
|
||||
Member4 = "This value was set after deserialization.";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void SerializationCallbacksExample()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user