-Updated documentation

This commit is contained in:
JamesNK
2011-07-28 12:03:50 +00:00
parent 8f01fa44f5
commit d664eee995
4 changed files with 74 additions and 65 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
<html> <html>
<head> <head>
<title>Customizing JSON serialization with attributes</title> <title>Serialization Attributes</title>
<link href="styles.css" rel="stylesheet" type="text/css" /> <link href="styles.css" rel="stylesheet" type="text/css" />
<link href="custom.css" rel="stylesheet" type="text/css" /> <link href="custom.css" rel="stylesheet" type="text/css" />
</head> </head>
@@ -10,7 +10,7 @@
<div id="control"> <div id="control">
<span class="productTitle">Json.NET - Quick Starts & API Documentation</span><br /> <span class="productTitle">Json.NET - Quick Starts & API Documentation</span><br />
<span class="topicTitle">Customizing JSON serialization with attributes</span></div> <span class="topicTitle">Serialization Attributes</span></div>
<div id="content"> <div id="content">
<span style="color: DarkGray"> </span> <span style="color: DarkGray"> </span>
+16 -11
View File
@@ -18,6 +18,16 @@
<p>JsonSerializer has a number of properties on it to customize how it serializes <p>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 JSON. These can also be used with the methods on JsonConvert via the
JsonSerializerSettings overloads.</p> JsonSerializerSettings overloads.</p>
<h3>MissingMemberHandling</h3>
<p>MissingMemberHandling controls how missing members, e.g. JSON contains a property
that isn&#39;t a member on the object, are handled during deserialization.</p>
<ul>
<li><strong>Ignore</strong> - By default Json.NET ignores JSON if there is no field
or property for its value to be set to during deserialization.</li>
<li><strong>Error</strong> - Json.NET errors when there is a missing member during
deserialization.</li>
</ul>
<h3>ReferenceLoopHandling</h3> <h3>ReferenceLoopHandling</h3>
<p>ReferenceLoopHandling controls how circular referencing objects, e.g. a Person <p>ReferenceLoopHandling controls how circular referencing objects, e.g. a Person
object referencing itself via a Manager property, are serialized.</p> object referencing itself via a Manager property, are serialized.</p>
@@ -32,16 +42,7 @@
reference loops. This is useful if objects are nested but not indefinitely. reference loops. This is useful if objects are nested but not indefinitely.
</li> </li>
</ul> </ul>
<p>ReferenceLoopHandling can also be customized on individual properties with JsonPropertyAttribute.</p>
<h3>MissingMemberHandling</h3>
<p>MissingMemberHandling controls how missing members, e.g. JSON contains a property
that isn&#39;t a member on the object, are handled during deserialization.</p>
<ul>
<li><strong>Ignore</strong> - By default Json.NET ignores JSON if there is no field
or property for its value to be set to during deserialization.</li>
<li><strong>Error</strong> - Json.NET errors when there is a missing member during
deserialization </li>
</ul>
<h3>NullValueHandling</h3> <h3>NullValueHandling</h3>
<p>NullValueHandling controls how null values on .NET objects are handled during <p>NullValueHandling controls how null values on .NET objects are handled during
serialization and how null values in JSON are handled during deserialization.</p> serialization and how null values in JSON are handled during deserialization.</p>
@@ -52,10 +53,11 @@
value is null when serializing and will skip setting fields/properties if the value is null when serializing and will skip setting fields/properties if the
JSON property is null when deserializing. </li> JSON property is null when deserializing. </li>
</ul> </ul>
<p>NullValueHandling can also be customized on individual properties with JsonPropertyAttribute.</p>
<h3> <h3>
DefaultValueHandling</h3> DefaultValueHandling</h3>
<p> <p>
&nbsp;DefaultValueHandling controls how Json.NET uses default values set using the .NET DefaultValueHandling controls how Json.NET uses default values set using the .NET
DefaultValueAttribute when serializing and deserializing.</p> DefaultValueAttribute when serializing and deserializing.</p>
<ul> <ul>
<li><strong>Include</strong> - By default Json.NET will write a field/property value <li><strong>Include</strong> - By default Json.NET will write a field/property value
@@ -67,6 +69,7 @@
Json.NET deserializer will skip setting a .NET object’s field/property if the Json.NET deserializer will skip setting a .NET object’s field/property if the
JSON value is the same as the default value. </li> JSON value is the same as the default value. </li>
</ul> </ul>
<p>DefaultValueHandling can also be customized on individual properties with JsonPropertyAttribute.</p>
<h3>ObjectCreationHandling</h3> <h3>ObjectCreationHandling</h3>
<p>ObjectCreationHandling controls how objects are created and deserialized to <p>ObjectCreationHandling controls how objects are created and deserialized to
during deserialization.</p> during deserialization.</p>
@@ -78,6 +81,7 @@
<li><strong>Replace</strong> - Json.NET will always recreate objects and collections <li><strong>Replace</strong> - Json.NET will always recreate objects and collections
before setting values to them during deserialization. </li> before setting values to them during deserialization. </li>
</ul> </ul>
<p>ObjectCreationHandling can also be customized on individual properties with JsonPropertyAttribute.</p>
<h3>TypeNameHandling</h3> <h3>TypeNameHandling</h3>
<p>TypeNameHandling controls whether Json.NET includes .NET type names during <p>TypeNameHandling controls whether Json.NET includes .NET type names during
serialization with a $type property and reads .NET type names from that property serialization with a $type property and reads .NET type names from that property
@@ -97,6 +101,7 @@
<li><strong>All</strong> - Json.NET will write and use type names for objects and <li><strong>All</strong> - Json.NET will write and use type names for objects and
collections. </li> collections. </li>
</ul> </ul>
<p>TypeNameHandling can also be customized on individual properties with JsonPropertyAttribute.</p>
<h3>TypeNameAssemblyFormat</h3> <h3>TypeNameAssemblyFormat</h3>
<p>TypeNameAssemblyFormat controls how type names are written during serialization.</p> <p>TypeNameAssemblyFormat controls how type names are written during serialization.</p>
<ul> <ul>
+2
View File
@@ -66,6 +66,8 @@
<Content Include="ContractResolver.html" /> <Content Include="ContractResolver.html" />
<Content Include="custom.css" /> <Content Include="custom.css" />
<Content Include="ConvertingJSONandXML.html" /> <Content Include="ConvertingJSONandXML.html" />
<Content Include="SerializationSettings.html" />
<Content Include="SerializationGuide.html" />
<Content Include="SerializingJSONFragments.html" /> <Content Include="SerializingJSONFragments.html" />
<Content Include="SelectToken.html" /> <Content Include="SelectToken.html" />
<Content Include="ReducingSerializedJSONSize.html" /> <Content Include="ReducingSerializedJSONSize.html" />
+6 -4
View File
@@ -1,15 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<siteMapNode title="Introduction" url="Introduction.html" isDefault="true" /> <siteMapNode title="Introduction" url="Introduction.html" isDefault="true" />
<siteMapNode title="Serializing and deserializing JSON" url="SerializingJSON.html"> <siteMapNode title="Serializing and Deserializing JSON" url="SerializingJSON.html">
<siteMapNode title="Customizing JSON serialization with attributes" url="SerializationAttributes.html" /> <siteMapNode title="Serialization Settings" url="SerializationSettings.html" />
<siteMapNode title="Serializing Dates in JSON" url="DatesInJSON.html" /> <siteMapNode title="Serialization Guide" url="SerializationGuide.html" />
<siteMapNode title="Serializing Collections" url="SerializingCollections.html" /> <siteMapNode title="Serialization Attributes" url="SerializationAttributes.html" />
<siteMapNode title="Serialization Callbacks" url="SerializationCallbacks.html" /> <siteMapNode title="Serialization Callbacks" url="SerializationCallbacks.html" />
<siteMapNode title="Serialization Error Handling" url="SerializationErrorHandling.html" /> <siteMapNode title="Serialization Error Handling" url="SerializationErrorHandling.html" />
<siteMapNode title="Serialization and Preserving Object References" url="PreserveObjectReferences.html" /> <siteMapNode title="Serialization and Preserving Object References" url="PreserveObjectReferences.html" />
<siteMapNode title="CustomCreationConverter" url="CustomCreationConverter.html" /> <siteMapNode title="CustomCreationConverter" url="CustomCreationConverter.html" />
<siteMapNode title="Contract Resolvers" url="ContractResolver.html" /> <siteMapNode title="Contract Resolvers" url="ContractResolver.html" />
<siteMapNode title="Serializing Collections" url="SerializingCollections.html" />
<siteMapNode title="Serializing Dates in JSON" url="DatesInJSON.html" />
<siteMapNode title="Reducing Serialized JSON Size" url="ReducingSerializedJSONSize.html" /> <siteMapNode title="Reducing Serialized JSON Size" url="ReducingSerializedJSONSize.html" />
<siteMapNode title="Serializing Partial JSON Fragments" url="SerializingJSONFragments.html" /> <siteMapNode title="Serializing Partial JSON Fragments" url="SerializingJSONFragments.html" />
</siteMapNode> </siteMapNode>