-Examples!

This commit is contained in:
James Newton-King
2013-01-28 00:07:21 +13:00
parent fd7970a3c3
commit 70ace8d527
115 changed files with 1120 additions and 210 deletions
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="DeserializeFromBson" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example deserializes BSON to an object.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Bson\DeserializeFromBson.cs" region="Types" title="Types" />
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Bson\DeserializeFromBson.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="DeserializeFromBsonCollection" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example sets <codeEntityReference>P:Newtonsoft.Json.Bson.BsonReader.ReadRootValueAsArray</codeEntityReference>
to <code>true</code> so the root BSON value is correctly read
as an array instead of an object and deserializes BSON to a collection.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Bson\DeserializeFromBsonCollection.cs" region="Types" title="Types" />
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Bson\DeserializeFromBsonCollection.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="SerializeToBson" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example serializes an object to BSON.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Bson\SerializeToBson.cs" region="Types" title="Types" />
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Bson\SerializeToBson.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+23 -29
View File
@@ -2,40 +2,34 @@
<topic id="Examples" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>Json.NET has the ability to conditionally serialize properties by placing a ShouldSerialize method on a class.
This funtionality is similar to the <externalLink>
<linkText>XmlSerializer ShouldSerialize feature</linkText>
<linkUri>http://msdn.microsoft.com/en-us/library/53b8022e.aspx</linkUri>
<linkTarget>_blank</linkTarget>
</externalLink>.</para>
<para>These are examples of Json.NET being used with JSON and .NET.</para>
</introduction>
<section>
<title>ShouldSerialize</title>
<title>Examples</title>
<content>
<para>To conditionally serialize a property add a boolean method with the same name as the property and then prefixed the method name
with ShouldSerialize. The result of the method determines whether the property is serialized. If the method returns true then the
property will be serialized, if it returns false and the property will be skipped.</para>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\ConditionalPropertiesTests.cs" region="EmployeeShouldSerializeExample" title="Employee class with a ShouldSerialize method" />
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\ConditionalPropertiesTests.cs" region="ShouldSerializeClassTest" title="ShouldSerialize output" />
<list class="bullet">
<listItem>
<para><legacyBold>Serializing JSON</legacyBold> - Serializing and deserializing JSON, serializer settings and serialization attributes</para>
</listItem>
<listItem>
<para><legacyBold>LINQ to JSON</legacyBold> - Parsing, querying, modifying and writing JSON</para>
</listItem>
<listItem>
<para><legacyBold>JSON Schema</legacyBold> - Parsing schemas and validating JSON</para>
</listItem>
<listItem>
<para><legacyBold>Converting XML</legacyBold> - Converting JSON to XML and XML to JSON</para>
</listItem>
<listItem>
<para><legacyBold>BSON</legacyBold> - Serializing and deserializing BSON</para>
</listItem>
<listItem>
<para><legacyBold>Reading and Writing JSON</legacyBold> - Reading JSON with JsonTextReader, writing JSON with JsonTextWriter</para>
</listItem>
</list>
</content>
</section>
<section>
<title>IContractResolver</title>
<content>
<para>ShouldSerialize can also be set using an <codeEntityReference>T:Newtonsoft.Json.Serialization.IContractResolver</codeEntityReference>.
Conditionally serializing a property using an IContractResolver is useful if you don't want to place a ShouldSerialize method on a class
or you didn't declare the class and are unable to.</para>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\ConditionalPropertiesTests.cs" region="ShouldSerializeContractResolver" title="Conditional properties with IContractResolver" />
</content>
</section>
<relatedTopics>
<codeEntityReference>T:Newtonsoft.Json.JsonSerializer</codeEntityReference>
<codeEntityReference>T:Newtonsoft.Json.Serialization.IContractResolver</codeEntityReference>
<codeEntityReference>P:Newtonsoft.Json.Serialization.JsonProperty.ShouldSerialize</codeEntityReference>
</relatedTopics>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ReadJsonWithJsonTextReader" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example reads JSON using the <codeEntityReference>T:Newtonsoft.Json.JsonTextReader</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Json\ReadJsonWithJsonTextReader.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="WriteJsonWithJsonTextWriter" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example writes JSON using the <codeEntityReference>T:Newtonsoft.Json.JsonTextWriter</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Json\WriteJsonWithJsonTextWriter.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="Clone" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example clones LINQ to JSON objects and all the cloned object's child values.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\Clone.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="CreateJsonAnonymousObject" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example creates a <codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>
from an anonymous type.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\CreateJsonAnonymousObject.cs" region="Types" title="Types" />
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\CreateJsonAnonymousObject.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="CreateJsonCollectionInitializer" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example creates <codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>
and <codeEntityReference>T:Newtonsoft.Json.Linq.JArray</codeEntityReference> instances using
the C# collection initializer syntax.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\CreateJsonCollectionInitializer.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="CreateJsonDeclaratively" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example creates <codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>
and <codeEntityReference>T:Newtonsoft.Json.Linq.JArray</codeEntityReference> instances declaratively
using LINQ.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\CreateJsonDeclaratively.cs" region="Types" title="Types" />
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\CreateJsonDeclaratively.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="CreateJsonDynamic" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example creates <codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>
and <codeEntityReference>T:Newtonsoft.Json.Linq.JArray</codeEntityReference> instances using
the C# dynamic functionality.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\CreateJsonDynamic.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="CreateJsonJTokenWriter" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example creates <codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>
and <codeEntityReference>T:Newtonsoft.Json.Linq.JArray</codeEntityReference> instances using
a <codeEntityReference>T:Newtonsoft.Json.Linq.JTokenWriter</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\CreateJsonJTokenWriter.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="CreateJsonManually" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example creates <codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>
and <codeEntityReference>T:Newtonsoft.Json.Linq.JArray</codeEntityReference> instances one at a time
programatically.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\CreateJsonManually.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="CreateReader" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example creates a <codeEntityReference>T:Newtonsoft.Json.Linq.JTokenReader</codeEntityReference>
from a <codeEntityReference>T:Newtonsoft.Json.Linq.JToken</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\CreateReader.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="CreateWriter" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example creates a <codeEntityReference>T:Newtonsoft.Json.Linq.JTokenWriter</codeEntityReference>
from a <codeEntityReference>T:Newtonsoft.Json.Linq.JToken</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\CreateWriter.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="DeepEquals" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example compares <codeEntityReference>T:Newtonsoft.Json.Linq.JToken</codeEntityReference>
instances using <codeEntityReference>M:Newtonsoft.Json.Linq.JToken.DeepEquals</codeEntityReference>,
comparing the token and all child tokens.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\DeepEquals.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="DeserializeWithLinq" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example uses LINQ to JSON to manually convert JSON to a .NET type.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\DeserializeWithLinq.cs" region="Types" title="Types" />
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\DeserializeWithLinq.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="FromObject" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example converts .NET values to LINQ to JSON using
<codeEntityReference>M:Newtonsoft.Json.Linq.JToken.FromObject(System.Object)</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\FromObject.cs" region="Types" title="Types" />
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\FromObject.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="JObjectProperties" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example gets an object's <codeEntityReference>T:Newtonsoft.Json.Linq.JProperty</codeEntityReference>
collection using <codeEntityReference>M:Newtonsoft.Json.Linq.JObject.Properties</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\JObjectProperties.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="JValueCast" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example casts <codeEntityReference>T:Newtonsoft.Json.Linq.JValue</codeEntityReference>
instances to .NET values.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\JValueCast.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="JValueValue" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example gets <codeEntityReference>T:Newtonsoft.Json.Linq.JValue</codeEntityReference>
internal values using <codeEntityReference>P:Newtonsoft.Json.Linq.JValue.Value</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\JValueValue.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ModifyJson" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example loads JSON, modifies <codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>
and <codeEntityReference>T:Newtonsoft.Json.Linq.JArray</codeEntityReference>
instances and then writes the JSON back out again.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\ModifyJson.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ParseJsonAny" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example parses JSON using
<codeEntityReference>M:Newtonsoft.Json.Linq.JToken.Parse</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\ParseJsonAny.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ParseJsonArray" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example parses a JSON array using
<codeEntityReference>M:Newtonsoft.Json.Linq.JArray.Parse</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\ParseJsonArray.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ParseJsonObject" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example parses a JSON object using
<codeEntityReference>M:Newtonsoft.Json.Linq.JObject.Parse</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\ParseJsonObject.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="QueryJson" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example loads JSON and then queries values from it using
<codeEntityReference>T:Newtonsoft.Json.Linq.JToken.Items(System.Object)</codeEntityReference> indexer
and then casts the returned tokens to .NET values.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\QueryJson.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="QueryJsonDynamic" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example loads JSON and then queries values from it using
C# dynamic functionality.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\QueryJsonDynamic.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="QueryJsonLinq" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example loads JSON and then queries values from it using LINQ operators.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\QueryJsonLinq.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="QueryJsonSelectToken" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example loads JSON and then queries values from it using <codeEntityReference>T:Newtonsoft.Json.Linq.JToken.SelectToken(System.String)</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\QueryJsonSelectToken.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="QueryJsonSelectTokenWithLinq" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example loads JSON and then queries values from it using a combination of <codeEntityReference>T:Newtonsoft.Json.Linq.JToken.SelectToken(System.String)</codeEntityReference>
and LINQ operators.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\QueryJsonSelectTokenWithLinq.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ReadJTokenFromBson" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example reads a <codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>
from BSON using <codeEntityReference>T:Newtonsoft.Json.Bson.BsonReader</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\ReadJTokenFromBson.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ReadJson" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example reads JSON from a file into a <codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\ReadJson.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="SerializeWithLinq" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example uses LINQ to JSON to manually convert a .NET type to JSON.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\SerializeWithLinq.cs" region="Types" title="Types" />
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\SerializeWithLinq.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ToObjectComplex" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example converts LINQ to JSON objects to .NET types using
<codeEntityReference>T:Newtonsoft.Json.Linq.JToken.ToObject`1</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\ToObjectComplex.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ToObjectGeneric" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example converts LINQ to JSON objects to .NET types using
<codeEntityReference>T:Newtonsoft.Json.Linq.JToken.ToObject`1</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\ToObjectGeneric.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ToObjectType" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example converts LINQ to JSON objects to .NET types using
<codeEntityReference>M:Newtonsoft.Json.Linq.JToken.ToObject(System.Type)</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\ToObjectType.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ToString" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example converts LINQ to JSON objects to JSON.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\ToString.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ToStringJsonConverter" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example uses a <codeEntityReference>T:Newtonsoft.Json.JsonConverter</codeEntityReference>
to customize converting LINQ to JSON objects to JSON.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\ToStringJsonConverter.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="WriteJTokenToBson" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example writes a <codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>
to BSON using <codeEntityReference>T:Newtonsoft.Json.Bson.BsonWriter</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\WriteJTokenToBson.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="WriteToJsonFile" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example writes LINQ to JSON objects to a file.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Linq\WriteToJsonFile.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="CreateJsonSchemaManually" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example creates a <codeEntityReference>T:Newtonsoft.Json.Schema.JsonSchema</codeEntityReference>
instance programmatically instead of loading a schema from JSON.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Schema\CreateJsonSchemaManually.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="JTokenIsValid" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example validates a <codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>
using the <codeEntityReference>M:Newtonsoft.Json.Schema.Extensions.IsValid(Newtonsoft.Json.Linq.JToken,Newtonsoft.Json.Schema.JsonSchema)</codeEntityReference>
extension method.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Schema\JTokenIsValid.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="JTokenIsValidWithMessages" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example validates a <codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>
using the <codeEntityReference>M:Newtonsoft.Json.Schema.Extensions.IsValid(Newtonsoft.Json.Linq.JToken,Newtonsoft.Json.Schema.JsonSchema)</codeEntityReference>
extension method and returns error messages.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Schema\JTokenIsValidWithMessages.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="JTokenValidateWithEvent" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example validates a <codeEntityReference>T:Newtonsoft.Json.Linq.JObject</codeEntityReference>
using the <codeEntityReference>M:Newtonsoft.Json.Schema.Extensions.IsValid(Newtonsoft.Json.Linq.JToken,Newtonsoft.Json.Schema.JsonSchema)</codeEntityReference>
extension method and raises an event for each validation error.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Schema\JTokenValidateWithEvent.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="JsonSchemaParse" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example parses a <codeEntityReference>T:Newtonsoft.Json.Schema.JsonSchema</codeEntityReference>
from JSON</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Schema\JsonSchemaParse.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="JsonValidatingReaderAndSerializer" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example validates JSON when deserializing an object using
<codeEntityReference>T:Newtonsoft.Json.JsonValidatingReader</codeEntityReference>.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Schema\JsonValidatingReaderAndSerializer.cs" region="Types" title="Types" />
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Schema\JsonValidatingReaderAndSerializer.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="LoadJsonSchemaFromFile" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example loads a <codeEntityReference>T:Newtonsoft.Json.Schema.JsonSchema</codeEntityReference>
from a file.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Schema\LoadJsonSchemaFromFile.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="RefJsonSchemaResolver" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example uses a <codeEntityReference>T:Newtonsoft.Json.Schema.JsonSchemaResolver</codeEntityReference>
to resolve schema references from different JSON documents.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Schema\RefJsonSchemaResolver.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="SaveJsonSchemaToFile" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example saves a <codeEntityReference>T:Newtonsoft.Json.Schema.JsonSchema</codeEntityReference>
to a file.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Schema\SaveJsonSchemaToFile.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
-70
View File
@@ -1,70 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="Serializer" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<!--
<summary>
<para>Optional summary abstract</para>
</summary>
-->
<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>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
and specify a title so that it can be jumped to with a hyperlink. -->
<section>
<title>DefaultContractResolver</title>
<content>
<!-- Uncomment this to create a sub-section outline
<autoOutline /> -->
<para>The <codeEntityReference>T:Newtonsoft.Json.Serialization.DefaultContractResolver</codeEntityReference>
is the default resolver used by the
serializer. It provides many avenues of extensibility in the form of
virtual methods that can be overriden.</para>
</content>
</section>
<section>
<title>CamelCasePropertyNamesContractResolver</title>
<content>
<!-- Uncomment this to create a sub-section outline
<autoOutline /> -->
<para><codeEntityReference>T:Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver</codeEntityReference>
inherits from DefaultContractResolver and simply overrides the JSON
property name to be written in <externalLink>
<linkText>camelcase</linkText>
<linkUri>http://en.wikipedia.org/wiki/CamelCase</linkUri>
<linkTarget>_blank</linkTarget>
</externalLink>.</para>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="ContractResolver" title="ContractResolver" />
</content>
</section>
<section>
<title>Custom IContractResolver Examples</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\PerformanceTests.cs" region="JsonConverterContractResolver" title="Use JsonConverter with IContractResolver" />
<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 conditionally serialize a property but don't want to add additional methods to your type.</para>
</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>
@@ -2,7 +2,7 @@
<topic id="DeserializeCustomCreationConverter" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example creates a class that inherits from <codeEntityReference>T:Newtonsoft.Json.CustomCreationConverter`1</codeEntityReference>
<para>This example creates a class that inherits from <codeEntityReference>T:Newtonsoft.Json.Converters.CustomCreationConverter`1</codeEntityReference>
that instantiates Employee instances for the Person type.</para>
</introduction>
<section>
@@ -3,7 +3,7 @@
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example uses <codeEntityReference>T:Newtonsoft.Json.JsonObjectAttribute</codeEntityReference>
to serialize a class that implements <codeEntityReference>T:System.IEnumerable`1</codeEntityReference> as
to serialize a class that implements <codeEntityReference>T:System.Collections.IEnumerable`1</codeEntityReference> as
a JSON object instead of a JSON array.</para>
</introduction>
<section>
+1 -1
View File
@@ -2,7 +2,7 @@
<topic id="SerializeDataSet" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example serializes a DataSet to JSON.</para>
<para>This example serializes a <codeEntityReference>T:System.Data.DataSet</codeEntityReference> to JSON.</para>
</introduction>
<section>
<title>Example</title>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ConvertJsonToXml" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example converts JSON to XML.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Xml\ConvertJsonToXml.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ConvertXmlToJson" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example converts XML to JSON.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Xml\ConvertXmlToJson.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="ConvertXmlToJsonForceArray" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>This example reads the <code>json:Array=&quot;true&quot;</code> attribute in the XML and places its value in an array
when converting the XML to JSON.</para>
</introduction>
<section>
<title>Example</title>
<content>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Examples\Xml\ConvertXmlToJsonForceArray.cs" region="Usage" title="Usage" />
</content>
</section>
</developerConceptualDocument>
</topic>