-Documentation
This commit is contained in:
+3
-3
@@ -28,19 +28,19 @@
|
||||
<para>There are a number of different options when it comes to creating
|
||||
JSON using LINQ to JSON.</para>
|
||||
|
||||
<para>The first to create objects imperatively. You
|
||||
<para>The first option is to set values one at a time. You
|
||||
have total control but it is more verbose than other options.</para>
|
||||
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateNormal" title="Creating JSON" />
|
||||
|
||||
<para>Another option is to create JSON objects declaratively.</para>
|
||||
<para>Another option is to create JSON objects declaratively using LINQ.</para>
|
||||
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateDeclaratively" title="Creating JSON Declaratively" />
|
||||
|
||||
<para>Finally you can create a JSON object from a non-JSON type using the
|
||||
<codeEntityReference>Overload:Newtonsoft.Json.Linq.JObject.FromObject</codeEntityReference>
|
||||
method. The example below is creating a JSON object from an anonymous object but any
|
||||
.NET type can be used with FromObject.</para>
|
||||
.NET type can be used with FromObject to create JSON.</para>
|
||||
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateFromObject" title="Creating JSON from an Object" />
|
||||
</content>
|
||||
|
||||
@@ -146,8 +146,8 @@
|
||||
(i.e. aren't lists, dictionaries, dynamic, implement ISerializable, etc)
|
||||
are serialized as JSON objects.</para>
|
||||
<para>By default types are serialized in opt-out mode. What that means is all public fields and properties with
|
||||
getters are automatically serialized to JSON and members that shouldn't be serialized are opted-out using the
|
||||
JsonIgnoreAttribute. To serialize private members the JsonPropertyAttribute can be placed on private fields and
|
||||
getters are automatically serialized to JSON and members that shouldn't be serialized are opted-out by placing
|
||||
JsonIgnoreAttribute on the unwanted properties. To serialize private members the JsonPropertyAttribute can be placed on private fields and
|
||||
properties or the DefaultMembersSearchFlags can be changed on DefaultContractResolver to change how members are
|
||||
serialized on all types.</para>
|
||||
<para>Types can also be serialized using opt-in mode. Only properties and fields that have a JsonPropertyAttribute
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<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>
|
||||
|
||||
<sections>
|
||||
<section>
|
||||
<title>DateFormatHandling</title>
|
||||
<content><para><codeEntityReference>T:Newtonsoft.Json.DateFormatHandling</codeEntityReference> controls how dates are serialized.</para>
|
||||
@@ -322,6 +322,7 @@
|
||||
</para>
|
||||
</content>
|
||||
</section>
|
||||
</sections>
|
||||
<relatedTopics>
|
||||
<externalLink>
|
||||
<linkText>Serialization Guide</linkText>
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
<introduction>
|
||||
<para>The quickest method of converting between JSON text and a .NET object is using the
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonSerializer</codeEntityReference>.
|
||||
The JsonSerializer converts .NET objects into their JSON equivalent and back again by mapping their properties to each other via name.</para>
|
||||
The JsonSerializer converts .NET objects into their JSON equivalent and back again by mapping the .NET object property names to the JSON property names
|
||||
and copies the values for you.</para>
|
||||
</introduction>
|
||||
<!-- Optional procedures followed by optional code example but must have
|
||||
at least one procedure or code example -->
|
||||
@@ -27,10 +28,6 @@
|
||||
</content>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<title>JsonSerializer</title>
|
||||
<content><para>For more control over how an object is serialized the <codeEntityReference>T:Newtonsoft.Json.JsonSerializer</codeEntityReference> can be used directly.
|
||||
|
||||
Reference in New Issue
Block a user