-Improved documentation
This commit is contained in:
+18
-10
@@ -9,13 +9,26 @@
|
||||
namespace.</para>
|
||||
</introduction>
|
||||
|
||||
<section>
|
||||
<title>Reading JSON</title>
|
||||
<content>
|
||||
<para>JSON values can be read from a string use the
|
||||
<codeEntityReference>M:Newtonsoft.Json.Linq.JToken.Parse(System.String)</codeEntityReference>
|
||||
method.</para>
|
||||
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateParse" title="Parsing a JSON Object from Text" />
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateParseArray" title="Parsing a JSON Array from Text" />
|
||||
</content>
|
||||
</section>
|
||||
<section>
|
||||
<title>Creating JSON</title>
|
||||
<content>
|
||||
<!-- Uncomment this to create a sub-section outline
|
||||
<autoOutline /> -->
|
||||
<para>There are a number of different options when it comes to creating
|
||||
JSON using LINQ to JSON. The first to create objects imperatively. You
|
||||
JSON using LINQ to JSON.</para>
|
||||
|
||||
<para>The first to create objects imperatively. 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" />
|
||||
@@ -24,17 +37,12 @@
|
||||
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateDeclaratively" title="Creating JSON Declaratively" />
|
||||
|
||||
<para>You can create a JSON object from a non-JSON type using the
|
||||
<para>Finally you can create a JSON object from a non-JSON type using the
|
||||
<codeEntityReference>Overload:Newtonsoft.Json.Linq.JObject.FromObject</codeEntityReference>
|
||||
method.</para>
|
||||
method. The example below is creating a JSON object from an anonymous object but any
|
||||
.NET type can be used with FromObject.</para>
|
||||
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateFromObject" title="Creating JSON From An Object" />
|
||||
|
||||
<para>Finally JSON objects can be created from a string use the
|
||||
<codeEntityReference>M:Newtonsoft.Json.Linq.JToken.Parse(System.String)</codeEntityReference>
|
||||
method.</para>
|
||||
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateParse" title="Creating JSON From Text" />
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateFromObject" title="Creating JSON from an Object" />
|
||||
</content>
|
||||
</section>
|
||||
<section>
|
||||
|
||||
@@ -5,11 +5,29 @@
|
||||
<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. These are low level classes and used internally by Json.NET.</para>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonWriter</codeEntityReference> classes.</para>
|
||||
|
||||
</introduction>
|
||||
<section>
|
||||
<title>JsonTextReader and JsonTextWriter</title>
|
||||
<content>
|
||||
|
||||
<alert class="note">
|
||||
<para>JsonReader and JsonWriter are low level classes and used internally by Json.NET.
|
||||
To quickly work with JSON either the serializer -
|
||||
<externalLink>
|
||||
<linkText>Serializing and Deserializing JSON</linkText>
|
||||
<linkUri>SerializingJSON.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
or using <externalLink>
|
||||
<linkText>LINQ to JSON</linkText>
|
||||
<linkUri>LINQtoJSON.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink> is recommended.
|
||||
</para>
|
||||
</alert>
|
||||
|
||||
<para><codeEntityReference>T:Newtonsoft.Json.JsonTextReader</codeEntityReference>
|
||||
and <codeEntityReference>T:Newtonsoft.Json.JsonTextWriter</codeEntityReference>
|
||||
are used to read and write JSON text.
|
||||
@@ -18,6 +36,10 @@
|
||||
count and quote character.</para>
|
||||
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\ReadingAndWritingJsonTests.cs" region="ReadingAndWritingJsonText" title="Writing JSON with JsonTextWriter" />
|
||||
|
||||
<para>JsonTextReader has settings on it for reading different date formats and time zones, and
|
||||
the culture used when reading text values.</para>
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\ReadingAndWritingJsonTests.cs" region="ReadingJsonText" title="Reading JSON with JsonTextReader" />
|
||||
</content>
|
||||
</section>
|
||||
<section>
|
||||
|
||||
@@ -193,6 +193,11 @@
|
||||
dictionary name/values will be written to the JSON object when serializing and properties on the JSON object will
|
||||
be added to the dictionary's name/values when deserializing. Additional members on the .NET dictionary are ignored
|
||||
during serialization.</para>
|
||||
<para>When serializing a dictionary the keys of the dictionary are converted to strings and used as the
|
||||
JSON object property names. The string written for a key can be customized by either overriding
|
||||
<codeEntityReference>M:System.Object.ToString</codeEntityReference> for the key type or by implementing a
|
||||
<codeEntityReference>T:System.ComponentModel.TypeConverter</codeEntityReference>. A TypeConverter will also
|
||||
support converting a custom string back again when deserializing a dictionary.</para>
|
||||
<para>JsonDictionaryAttribute has options on it to customize the JsonConverter, type name handling and reference
|
||||
handling that are applied to collection items.</para>
|
||||
<para>When deserializing if a member is typed as the interface IDictionary<TKey, TValue> then it will be
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<section>
|
||||
<title>DateFormatHandling</title>
|
||||
<content><para>DateFormatHandling controls how dates are serialized.</para>
|
||||
<content><para><codeEntityReference>T:Newtonsoft.Json.DateFormatHandling</codeEntityReference> controls how dates are serialized.</para>
|
||||
|
||||
<table>
|
||||
<tableHeader>
|
||||
@@ -24,11 +24,11 @@
|
||||
</tableHeader>
|
||||
<row>
|
||||
<entry><para><legacyBold>IsoDateFormat</legacyBold></para></entry>
|
||||
<entry><para>By default Json.NET writes dates in the ISO 8601 format, e.g. "2012-03-21T05:40Z".</para></entry>
|
||||
<entry><para>By default Json.NET writes dates in the ISO 8601 format, e.g. <codeInline>"2012-03-21T05:40Z"</codeInline>.</para></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><para><legacyBold>MicrosoftDateFormat</legacyBold></para></entry>
|
||||
<entry><para>Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/".</para></entry>
|
||||
<entry><para>Dates are written in the Microsoft JSON format, e.g. <codeInline>"\/Date(1198908717056)\/"</codeInline>.</para></entry>
|
||||
</row>
|
||||
</table>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
<section>
|
||||
<title>MissingMemberHandling</title>
|
||||
<content><para>MissingMemberHandling controls how missing members, e.g. JSON contains a property that isn't a member on the object, are handled during deserialization.</para>
|
||||
<content><para><codeEntityReference>T:Newtonsoft.Json.MissingMemberHandling</codeEntityReference> controls how missing members, e.g. JSON contains a property that isn't a member on the object, are handled during deserialization.</para>
|
||||
|
||||
<table>
|
||||
<tableHeader>
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
<section>
|
||||
<title>ReferenceLoopHandling</title>
|
||||
<content><para>ReferenceLoopHandling controls how circular referencing objects, e.g. a Person object referencing itself via a Manager property, are serialized.</para>
|
||||
<content><para><codeEntityReference>T:Newtonsoft.Json.ReferenceLoopHandling</codeEntityReference> controls how circular referencing objects, e.g. a Person object referencing itself via a Manager property, are serialized.</para>
|
||||
|
||||
<table>
|
||||
<tableHeader>
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
<section>
|
||||
<title>NullValueHandling</title>
|
||||
<content><para>NullValueHandling controls how null values on .NET objects are handled during serialization and how null values in JSON are handled during deserialization.</para>
|
||||
<content><para><codeEntityReference>T:Newtonsoft.Json.NullValueHandling</codeEntityReference> controls how null values on .NET objects are handled during serialization and how null values in JSON are handled during deserialization.</para>
|
||||
|
||||
<table>
|
||||
<tableHeader>
|
||||
@@ -114,7 +114,7 @@
|
||||
|
||||
<section>
|
||||
<title>DefaultValueHandling</title>
|
||||
<content><para>DefaultValueHandling controls how Json.NET uses default values set using the .NET DefaultValueAttribute when serializing and deserializing.</para>
|
||||
<content><para><codeEntityReference>T:Newtonsoft.Json.DefaultValueHandling</codeEntityReference> controls how Json.NET uses default values set using the .NET <codeEntityReference>T:System.ComponentModel.DefaultValueAttribute</codeEntityReference> when serializing and deserializing.</para>
|
||||
|
||||
<table>
|
||||
<tableHeader>
|
||||
@@ -139,7 +139,7 @@
|
||||
|
||||
<section>
|
||||
<title>ObjectCreationHandling</title>
|
||||
<content><para>ObjectCreationHandling controls how objects are created and deserialized to during deserialization.</para>
|
||||
<content><para><codeEntityReference>T:Newtonsoft.Json.ObjectCreationHandling</codeEntityReference> controls how objects are created and deserialized to during deserialization.</para>
|
||||
|
||||
<table>
|
||||
<tableHeader>
|
||||
@@ -168,7 +168,7 @@
|
||||
|
||||
<section>
|
||||
<title>TypeNameHandling</title>
|
||||
<content><para>TypeNameHandling controls whether Json.NET includes .NET type names during serialization with a $type property and reads .NET type names from that property to determine what type to create during deserialization.</para>
|
||||
<content><para><codeEntityReference>T:Newtonsoft.Json.TypeNameHandling</codeEntityReference> controls whether Json.NET includes .NET type names during serialization with a $type property and reads .NET type names from that property to determine what type to create during deserialization.</para>
|
||||
|
||||
<table>
|
||||
<tableHeader>
|
||||
@@ -205,7 +205,7 @@
|
||||
|
||||
<section>
|
||||
<title>TypeNameAssemblyFormat</title>
|
||||
<content><para>TypeNameAssemblyFormat controls how type names are written during serialization.</para>
|
||||
<content><para><codeEntityReference>T:System.Runtime.Serialization.Formatters.FormatterAssemblyStyle</codeEntityReference> controls how type names are written during serialization.</para>
|
||||
|
||||
<table>
|
||||
<tableHeader>
|
||||
@@ -230,14 +230,14 @@
|
||||
|
||||
<section>
|
||||
<title>Binder</title>
|
||||
<content><para>The serialization binder is used to resolve type names to a .NET type.</para>
|
||||
<content><para>The <codeEntityReference>T:System.Runtime.Serialization.SerializationBinder</codeEntityReference> is used to resolve type names to a .NET type.</para>
|
||||
<para>Read more about the serialization binder here: <codeEntityReference>T:System.Runtime.Serialization.SerializationBinder</codeEntityReference></para>
|
||||
</content>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>ConstructorHandling</title>
|
||||
<content><para>ConstructorHandling controls how constructors are used when initializing objects during deserialization.</para>
|
||||
<content><para><codeEntityReference>T:Newtonsoft.Json.ConstructorHandling</codeEntityReference> controls how constructors are used when initializing objects during deserialization.</para>
|
||||
|
||||
<table>
|
||||
<tableHeader>
|
||||
@@ -265,7 +265,7 @@
|
||||
<section>
|
||||
<title>Converters</title>
|
||||
<content><para>This is the collection of JsonConverters that will be used during serialization and deserialization.</para>
|
||||
<para>JsonConverters allows JSON to be manually written during serialization and read during deserialization.
|
||||
<para>A <codeEntityReference>T:Newtonsoft.Json.JsonConverter</codeEntityReference> allows JSON to be manually written during serialization and read during deserialization.
|
||||
This is useful for particularly complex JSON structures or for when you want to change how a type is serialized.</para>
|
||||
<para>When a JsonConverter has been added to a JsonSerializer it will be checked for every value that is being serialized/deserialized
|
||||
using its CanConvert to see if it should be used. If CanConvert returns true then the JsonConverter will be used to read or write
|
||||
@@ -300,7 +300,8 @@
|
||||
<section>
|
||||
<title>ContractResolver</title>
|
||||
<content><para>Internally for every .NET type the JsonSerializer will create a contract of how the type should be serialized and deserialized,
|
||||
based on type metadata and attributes applied to the class. Specifying a custom IContractResolver allows the creation of contracts to be customized.</para>
|
||||
based on type metadata and attributes applied to the class. Specifying a custom <codeEntityReference>T:Newtonsoft.Json.Serialization.IContractResolver</codeEntityReference>
|
||||
allows the creation of contracts to be customized.</para>
|
||||
<para>Read more about Contract Resolvers here: <externalLink>
|
||||
<linkText>Contract Resolvers</linkText>
|
||||
<linkUri>ContractResolver.htm</linkUri>
|
||||
@@ -311,7 +312,7 @@
|
||||
|
||||
<section>
|
||||
<title>Error</title>
|
||||
<content><para>The Error event can catch errors during serialization and either handle the event and continue with
|
||||
<content><para>The <codeEntityReference>E:Newtonsoft.Json.JsonSerializer.Error</codeEntityReference> event can catch errors during serialization and either handle the event and continue with
|
||||
serialization or let the error bubble up and be thrown to the application.</para>
|
||||
<para>Read more about error handling here: <externalLink>
|
||||
<linkText>Serialization Error Handling</linkText>
|
||||
@@ -337,9 +338,11 @@
|
||||
<linkUri>DatesInJSON.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
|
||||
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonSerializer</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonSerializerSettings</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonConverter</codeEntityReference>
|
||||
<codeEntityReference>T:System.Runtime.Serialization.SerializationBinder</codeEntityReference>
|
||||
</relatedTopics>
|
||||
</developerConceptualDocument>
|
||||
</topic>
|
||||
@@ -54,6 +54,11 @@
|
||||
</content>
|
||||
</section>
|
||||
<relatedTopics>
|
||||
<externalLink>
|
||||
<linkText>Serialization Guide</linkText>
|
||||
<linkUri>SerializationGuide.htm</linkUri>
|
||||
<linkTarget>_self</linkTarget>
|
||||
</externalLink>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonConvert</codeEntityReference>
|
||||
<codeEntityReference>T:Newtonsoft.Json.JsonSerializer</codeEntityReference>
|
||||
</relatedTopics>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<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" />
|
||||
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="SerializeObject" title="Serializing and Deserializing JSON with JsonConvert" />
|
||||
<para>
|
||||
SerializeObject and DeserializeObject both have overloads that take a <codeEntityReference>T:Newtonsoft.Json.JsonSerializerSettings</codeEntityReference> object.
|
||||
JsonSerializerSettings lets you use many of the JsonSerializer settings listed below while still using the simple serialization methods.
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
string json = array.ToString();
|
||||
// [
|
||||
// "Manual text",
|
||||
// "\/Date(958996800000+1200)\/"
|
||||
// "2000-05-23T00:00:00"
|
||||
// ]
|
||||
#endregion
|
||||
}
|
||||
@@ -173,7 +173,7 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
CPU: 'Intel',
|
||||
Drives: [
|
||||
'DVD read/writer',
|
||||
""500 gigabyte hard drive""
|
||||
'500 gigabyte hard drive'
|
||||
]
|
||||
}";
|
||||
|
||||
@@ -181,6 +181,19 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
#endregion
|
||||
}
|
||||
|
||||
public void LinqToJsonCreateParseArray()
|
||||
{
|
||||
#region LinqToJsonCreateParseArray
|
||||
string json = @"[
|
||||
'Small',
|
||||
'Medium',
|
||||
'Large'
|
||||
]";
|
||||
|
||||
JArray a = JArray.Parse(json);
|
||||
#endregion
|
||||
}
|
||||
|
||||
public void LinqToJsonQuerying()
|
||||
{
|
||||
JObject rss = new JObject();
|
||||
|
||||
@@ -49,7 +49,8 @@ using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Documentation
|
||||
{
|
||||
public class ReadingAndWritingJsonTests
|
||||
[TestFixture]
|
||||
public class ReadingAndWritingJsonTests : TestFixtureBase
|
||||
{
|
||||
public void ReadingAndWritingJsonText()
|
||||
{
|
||||
@@ -89,6 +90,46 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
#endregion
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReadingJsonText()
|
||||
{
|
||||
#region ReadingJsonText
|
||||
string json = @"{
|
||||
'CPU': 'Intel',
|
||||
'PSU': '500W',
|
||||
'Drives': [
|
||||
'DVD read/writer'
|
||||
/*(broken)*/,
|
||||
'500 gigabyte hard drive',
|
||||
'200 gigabype hard drive'
|
||||
]
|
||||
}";
|
||||
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json));
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.Value != null)
|
||||
Console.WriteLine("Token: {0}, Value: {1}", reader.TokenType, reader.Value);
|
||||
else
|
||||
Console.WriteLine("Token: {0}", reader.TokenType);
|
||||
}
|
||||
|
||||
// Token: StartObject
|
||||
// Token: PropertyName, Value: CPU
|
||||
// Token: String, Value: Intel
|
||||
// Token: PropertyName, Value: PSU
|
||||
// Token: String, Value: 500W
|
||||
// Token: PropertyName, Value: Drives
|
||||
// Token: StartArray
|
||||
// Token: String, Value: DVD read/writer
|
||||
// Token: Comment, Value: (broken)
|
||||
// Token: String, Value: 500 gigabyte hard drive
|
||||
// Token: String, Value: 200 gigabype hard drive
|
||||
// Token: EndArray
|
||||
// Token: EndObject
|
||||
#endregion
|
||||
}
|
||||
|
||||
public void ReadingAndWritingJsonLinq()
|
||||
{
|
||||
#region ReadingAndWritingJsonLinq
|
||||
|
||||
@@ -332,13 +332,13 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
//[
|
||||
// {
|
||||
// "Name": "James",
|
||||
// "BirthDate": "\/Date(346377600000)\/",
|
||||
// "LastModified": "\/Date(1235134761000)\/"
|
||||
// "BirthDate": "1980-12-23T00:00:00Z",
|
||||
// "LastModified": "2009-02-20T12:59:21Z"
|
||||
// },
|
||||
// {
|
||||
// "Name": "James",
|
||||
// "BirthDate": "\/Date(346377600000)\/",
|
||||
// "LastModified": "\/Date(1235134761000)\/"
|
||||
// "BirthDate": "1980-12-23T00:00:00Z",
|
||||
// "LastModified": "2009-02-20T12:59:21Z"
|
||||
// }
|
||||
//]
|
||||
#endregion
|
||||
@@ -356,8 +356,8 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
// {
|
||||
// "$id": "1",
|
||||
// "Name": "James",
|
||||
// "BirthDate": "\/Date(346377600000)\/",
|
||||
// "LastModified": "\/Date(1235134761000)\/"
|
||||
// "BirthDate": "1983-03-08T00:00Z",
|
||||
// "LastModified": "2012-03-21T05:40Z"
|
||||
// },
|
||||
// {
|
||||
// "$ref": "1"
|
||||
@@ -428,14 +428,14 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
// {
|
||||
// "FirstName": "Maurice",
|
||||
// "LastName": "Moss",
|
||||
// "BirthDate": "\/Date(252291661000)\/",
|
||||
// "BirthDate": "1981-03-08T00:00Z",
|
||||
// "Department": "IT",
|
||||
// "JobTitle": "Support"
|
||||
// },
|
||||
// {
|
||||
// "FirstName": "Jen",
|
||||
// "LastName": "Barber",
|
||||
// "BirthDate": "\/Date(258771661000)\/",
|
||||
// "BirthDate": "1985-12-10T00:00Z",
|
||||
// "Department": "IT",
|
||||
// "JobTitle": "Manager"
|
||||
// }
|
||||
@@ -478,7 +478,7 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
|
||||
//{
|
||||
// "name": "Widget",
|
||||
// "expiryDate": "\/Date(1292868060000)\/",
|
||||
// "expiryDate": "2010-12-20T18:01Z",
|
||||
// "price": 9.99,
|
||||
// "sizes": [
|
||||
// "Small",
|
||||
@@ -513,13 +513,13 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
//[
|
||||
// {
|
||||
// "Name": "Product 1",
|
||||
// "ExpiryDate": "\/Date(978048000000)\/",
|
||||
// "ExpiryDate": "2000-12-29T00:00Z",
|
||||
// "Price": 99.95,
|
||||
// "Sizes": null
|
||||
// },
|
||||
// {
|
||||
// "Name": "Product 2",
|
||||
// "ExpiryDate": "\/Date(1248998400000)\/",
|
||||
// "ExpiryDate": "2009-07-31T00:00Z",
|
||||
// "Price": 12.50,
|
||||
// "Sizes": null
|
||||
// }
|
||||
@@ -533,13 +533,13 @@ namespace Newtonsoft.Json.Tests.Documentation
|
||||
string json = @"[
|
||||
{
|
||||
'Name': 'Product 1',
|
||||
'ExpiryDate': '\/Date(978048000000)\/',
|
||||
'ExpiryDate': '2000-12-29T00:00Z',
|
||||
'Price': 99.95,
|
||||
'Sizes': null
|
||||
},
|
||||
{
|
||||
'Name': 'Product 2',
|
||||
'ExpiryDate': '\/Date(1248998400000)\/',
|
||||
'ExpiryDate': '2009-07-31T00:00Z',
|
||||
'Price': 12.50,
|
||||
'Sizes': null
|
||||
}
|
||||
|
||||
@@ -72,5 +72,5 @@ using System.Security;
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("4.5.0.0")]
|
||||
#if !PocketPC
|
||||
[assembly: AssemblyFileVersion("4.5.7.15122")]
|
||||
[assembly: AssemblyFileVersion("4.5.7.15127")]
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,10 @@ namespace Newtonsoft.Json
|
||||
/// <summary>
|
||||
/// Specifies default value handling options for the <see cref="JsonSerializer"/>.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="ReducingSerializedJsonSizeDefaultValueHandlingObject" title="DefaultValueHandling Class" />
|
||||
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="ReducingSerializedJsonSizeDefaultValueHandlingExample" title="DefaultValueHandling Ignore Example" />
|
||||
/// </example>
|
||||
[Flags]
|
||||
public enum DefaultValueHandling
|
||||
{
|
||||
|
||||
@@ -45,6 +45,9 @@ namespace Newtonsoft.Json
|
||||
/// <summary>
|
||||
/// Provides methods for converting between common language runtime types and JSON types.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="SerializeObject" title="Serializing and Deserializing JSON with JsonConvert" />
|
||||
/// </example>
|
||||
public static class JsonConvert
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -34,6 +34,9 @@ namespace Newtonsoft.Json.Linq
|
||||
/// <summary>
|
||||
/// Represents a JSON array.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateParseArray" title="Parsing a JSON Array from Text" />
|
||||
/// </example>
|
||||
public class JArray : JContainer, IList<JToken>
|
||||
{
|
||||
private readonly IList<JToken> _values = new List<JToken>();
|
||||
@@ -135,6 +138,9 @@ namespace Newtonsoft.Json.Linq
|
||||
/// </summary>
|
||||
/// <param name="json">A <see cref="String"/> that contains JSON.</param>
|
||||
/// <returns>A <see cref="JArray"/> populated from the string that contains JSON.</returns>
|
||||
/// <example>
|
||||
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateParseArray" title="Parsing a JSON Array from Text" />
|
||||
/// </example>
|
||||
public static new JArray Parse(string json)
|
||||
{
|
||||
JsonReader reader = new JsonTextReader(new StringReader(json));
|
||||
|
||||
@@ -48,6 +48,9 @@ namespace Newtonsoft.Json.Linq
|
||||
/// <summary>
|
||||
/// Represents a JSON object.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateParse" title="Parsing a JSON Object from Text" />
|
||||
/// </example>
|
||||
public class JObject : JContainer, IDictionary<string, JToken>, INotifyPropertyChanged
|
||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
||||
, ICustomTypeDescriptor
|
||||
@@ -315,6 +318,9 @@ namespace Newtonsoft.Json.Linq
|
||||
/// </summary>
|
||||
/// <param name="json">A <see cref="String"/> that contains JSON.</param>
|
||||
/// <returns>A <see cref="JObject"/> populated from the string that contains JSON.</returns>
|
||||
/// <example>
|
||||
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateParse" title="Parsing a JSON Object from Text" />
|
||||
/// </example>
|
||||
public static new JObject Parse(string json)
|
||||
{
|
||||
JsonReader reader = new JsonTextReader(new StringReader(json));
|
||||
|
||||
@@ -28,6 +28,10 @@ namespace Newtonsoft.Json
|
||||
/// <summary>
|
||||
/// Specifies null value handling options for the <see cref="JsonSerializer"/>.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="ReducingSerializedJsonSizeNullValueHandlingObject" title="NullValueHandling Class" />
|
||||
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="ReducingSerializedJsonSizeNullValueHandlingExample" title="NullValueHandling Ignore Example" />
|
||||
/// </example>
|
||||
public enum NullValueHandling
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -32,6 +32,9 @@ namespace Newtonsoft.Json
|
||||
/// <summary>
|
||||
/// Specifies reference handling options for the <see cref="JsonSerializer"/>.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="PreservingObjectReferencesOn" title="Preserve Object References" />
|
||||
/// </example>
|
||||
[Flags]
|
||||
public enum PreserveReferencesHandling
|
||||
{
|
||||
|
||||
@@ -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.7.15122")]
|
||||
[assembly: AssemblyFileVersion("4.5.7.15127")]
|
||||
#endif
|
||||
|
||||
[assembly: CLSCompliant(true)]
|
||||
|
||||
@@ -30,6 +30,10 @@ namespace Newtonsoft.Json.Serialization
|
||||
/// <summary>
|
||||
/// Used by <see cref="JsonSerializer"/> to resolves a <see cref="JsonContract"/> for a given <see cref="Type"/>.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="ReducingSerializedJsonSizeContractResolverObject" title="IContractResolver Class" />
|
||||
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="ReducingSerializedJsonSizeContractResolverExample" title="IContractResolver Example" />
|
||||
/// </example>
|
||||
public interface IContractResolver
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user