-Documentation
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
<relatedTopics>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonSerializer</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.Serialization.IContractResolver</codeEntityReference>
|
||||
<codeEntityReference>M:Newtonsoft.Json.Serialization.JsonProperty.ShouldSerialize</codeEntityReference>
|
||||
<codeEntityReference>P:Newtonsoft.Json.Serialization.JsonProperty.ShouldSerialize</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
+13
-14
@@ -9,11 +9,10 @@
|
||||
<introduction>
|
||||
<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 without placing attributes on your classes.</para>
|
||||
<para>Implementing the IContractResolver interface and then assigning an
|
||||
instance to a JsonSerializer lets you control whether the object is
|
||||
serialized as a JSON object or JSON array, what object members should be
|
||||
serialized, how they are serialized and what they are called.</para>
|
||||
JsonSerializer serializes and deserializes .NET objects to JSON without placing attributes on your classes.
|
||||
</para>
|
||||
<para>Anything that can be set on an object, collection, property, etc, using attributes or methods to control serialization
|
||||
can also be set using an IContractResolver.</para>
|
||||
</introduction>
|
||||
<!-- Add one or more top-level section elements. These are collapsible.
|
||||
If using <autoOutline />, add an address attribute to identify it
|
||||
@@ -46,20 +45,20 @@
|
||||
</content>
|
||||
</section>
|
||||
<section>
|
||||
<title>Custom Examples</title>
|
||||
<title>Custom IContractResolver Examples</title>
|
||||
<content>
|
||||
<para>Setting a <codeEntityReference>T:Newtonsoft.Json.JsonConverter</codeEntityReference> on a type
|
||||
using an IContractResolver.</para>
|
||||
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\PerformanceTests.cs" region="JsonConverterContractResolver" title="Use JsonConverter with IContractResolver" />
|
||||
|
||||
<para><externalLink>
|
||||
<linkText>Conditionally serializing properties</linkText>
|
||||
<linkUri>ConditionalProperties.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink> using an IContractResolver.</para>
|
||||
<para>This example sets a <codeEntityReference>T:Newtonsoft.Json.JsonConverter</codeEntityReference> for a type
|
||||
using an IContractResolver. Using a contract resolver here is useful because DateTime is not your own type and it is not possible to place a JsonConverterAttribute on it.</para>
|
||||
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\ConditionalPropertiesTests.cs" region="ShouldSerializeContractResolver" title="Conditional properties with IContractResolver" />
|
||||
|
||||
<para>This example sets up <externalLink>
|
||||
<linkText>conditional serialization for a property</linkText>
|
||||
<linkUri>ConditionalProperties.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink> using an IContractResolver. This is useful if you want to conditional serialize a property but don't want to add additional methods to your type.</para>
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</listItem>
|
||||
<listItem>
|
||||
<para>
|
||||
Supports dynamic programming
|
||||
Dynamic programming
|
||||
</para>
|
||||
</listItem>
|
||||
<listItem>
|
||||
@@ -71,7 +71,7 @@
|
||||
</content>
|
||||
</section>
|
||||
<section>
|
||||
<title>Performance</title>
|
||||
<title>Benchmarks</title>
|
||||
<content>
|
||||
<para>Json.NET is slightly slower at writing JSON than Windows.Data.Json but considerably faster at parsing JSON.</para>
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
<title>Converting Between LINQ to JSON and Windows.Data.Json</title>
|
||||
<content>
|
||||
<para>Json.NET supports converting between the types of the two libraries.
|
||||
This feature is useful if you are working with another API but you want to use Json.NET inside your own code.</para>
|
||||
This feature is useful if you are working with another API that uses Windows.Data.Json types but you want to use Json.NET inside your own code.</para>
|
||||
<para>Use <codeEntityReference>Overload:Newtonsoft.Json.Linq.JToken.FromObject</codeEntityReference> to convert a Windows.Data.Json
|
||||
value to LINQ to JSON and use <codeEntityReference>Overload:Newtonsoft.Json.Linq.JToken.ToObject</codeEntityReference> to convert LINQ to JSON to Windows.Data.Json.</para>
|
||||
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Topics>
|
||||
<Topic id="Introduction" visible="True" isDefault="true" />
|
||||
<Topic id="SerializingJSON" visible="True" title="Serializing and Deserializing JSON">
|
||||
<Topic id="SerializingJSON" visible="True" isExpanded="true" title="Serializing and Deserializing JSON">
|
||||
<Topic id="SerializationSettings" visible="True" title="Serialization Settings" />
|
||||
<Topic id="SerializationGuide" visible="True" title="Serialization Guide" />
|
||||
<Topic id="SerializationAttributes" visible="True" title="Serialization Attributes" />
|
||||
@@ -13,7 +13,7 @@
|
||||
<Topic id="DatesInJSON" visible="True" title="Serializing Dates in JSON" />
|
||||
<Topic id="ReducingSerializedJSONSize" visible="True" title="Reducing Serialized JSON Size" />
|
||||
<Topic id="SerializingJSONFragments" visible="True" title="Serializing Partial JSON Fragments" />
|
||||
<Topic id="ConditionalProperties" visible="True" title="Conditional Properties" />
|
||||
<Topic id="ConditionalProperties" visible="True" isSelected="true" title="Conditional Property Serialization" />
|
||||
<Topic id="ContractResolver" visible="True" title="Serialization using ContractResolver" />
|
||||
</Topic>
|
||||
<Topic id="LINQtoJSON" visible="True" title="LINQ to JSON">
|
||||
@@ -26,6 +26,6 @@
|
||||
<Topic id="JsonSchema" visible="True" title="Validating JSON" />
|
||||
<Topic id="ReadingWritingJSON" visible="True" title="Basic Reading and Writing JSON" />
|
||||
<Topic id="ConvertingJSONandXML" visible="True" title="Converting between JSON and XML" />
|
||||
<Topic id="JsonNetVsDotNetSerializers" visible="True" isSelected="true" title="Json.NET vs .NET Serializers" />
|
||||
<Topic id="JsonNetVsDotNetSerializers" visible="True" title="Json.NET vs .NET Serializers" />
|
||||
<Topic id="JsonNetVsWindowsDataJson" visible="True" title="Json.NET vs Windows.Data.Json" />
|
||||
</Topics>
|
||||
@@ -76,5 +76,5 @@ using System.Security;
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("4.5.0.0")]
|
||||
#if !PocketPC
|
||||
[assembly: AssemblyFileVersion("4.5.10.15502")]
|
||||
[assembly: AssemblyFileVersion("4.5.10.15503")]
|
||||
#endif
|
||||
|
||||
@@ -90,7 +90,7 @@ using System.Security;
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("4.5.0.0")]
|
||||
#if !PocketPC
|
||||
[assembly: AssemblyFileVersion("4.5.10.15502")]
|
||||
[assembly: AssemblyFileVersion("4.5.10.15503")]
|
||||
#endif
|
||||
|
||||
[assembly: CLSCompliant(true)]
|
||||
|
||||
Reference in New Issue
Block a user