diff --git a/Doc/JsonSchema.aml b/Doc/JsonSchema.aml new file mode 100644 index 00000000..f34bf786 --- /dev/null +++ b/Doc/JsonSchema.aml @@ -0,0 +1,62 @@ + + + + + Json.NET supports the JSON Schema standard via the T:Newtonsoft.Json.Schema.JsonSchema + and T:Newtonsoft.Json.JsonValidatingReader classes and sits under + the N:Newtonsoft.Json.Schema namespae. + JSON Schema is used to validate the structure and + data types of a piece of JSON, similar to XML Schema for XML. Read more about JSON Schema at + + json-schema.org + http://json-schema.org/ + _blank + . + + +
+ Validating with JSON Schema + +The simplest way to check if JSON is valid is to load the JSON into a JObject or JArray and then +use the M:Newtonsoft.Json.Schema.Extensions.IsValid(Newtonsoft.Json.Linq.JToken,Newtonsoft.Json.Schema.JsonSchema) +method with the JSON Schema. + + + +To get validation error messages use the +M:Newtonsoft.Json.Schema.Extensions.IsValid(Newtonsoft.Json.Linq.JToken,Newtonsoft.Json.Schema.JsonSchema,System.Collections.Generic.IList{System.String}@) +or +M:Newtonsoft.Json.Schema.Extensions.Validate(Newtonsoft.Json.Linq.JToken,Newtonsoft.Json.Schema.JsonSchema,Newtonsoft.Json.Schema.ValidationEventHandler) +overloads. + + + +Internally IsValid uses T:Newtonsoft.Json.JsonValidatingReader +to perform the JSON Schema validation. To skip the overhead of loading JSON into a JObject/JArray, validating +the JSON and then deserializing the JSON into a class, JsonValidatingReader can be used with JsonSerializer to validate JSON while the object is being deserialized. + + + + +
+ +
+ Creating JSON Schemas + + +The simplest way to get a T:Newtonsoft.Json.Schema.JsonSchema object is to load it from a string or a file. + + +It is also possible to create JsonSchema objects in code. + + + +
+ + T:Newtonsoft.Json.Schema.JsonSchema + T:Newtonsoft.Json.JsonValidatingReader + + +
+
\ No newline at end of file diff --git a/Doc/LINQtoJSON.aml b/Doc/LINQtoJSON.aml index 806d1027..c4bca7b9 100644 --- a/Doc/LINQtoJSON.aml +++ b/Doc/LINQtoJSON.aml @@ -3,7 +3,7 @@ LINQ to JSON is an API for working with JSON objects. - The API has been designed with LINQ in mind to enable to quick querying + It has been designed with LINQ in mind to enable to quick querying and creation of JSON objects. LINQ to JSON sits under the N:Newtonsoft.Json.Linq namespace. diff --git a/Doc/doc.content b/Doc/doc.content index b1d8418b..a7d32cd5 100644 --- a/Doc/doc.content +++ b/Doc/doc.content @@ -15,12 +15,13 @@ - - + + + \ No newline at end of file diff --git a/Doc/doc.shfbproj b/Doc/doc.shfbproj index 3cd7e6b9..9be93ec3 100644 --- a/Doc/doc.shfbproj +++ b/Doc/doc.shfbproj @@ -141,6 +141,9 @@ + + + diff --git a/Src/Newtonsoft.Json.Tests/Documentation/LinqToJsonTests.cs b/Src/Newtonsoft.Json.Tests/Documentation/LinqToJsonTests.cs index 58170868..4ae7b133 100644 --- a/Src/Newtonsoft.Json.Tests/Documentation/LinqToJsonTests.cs +++ b/Src/Newtonsoft.Json.Tests/Documentation/LinqToJsonTests.cs @@ -50,6 +50,14 @@ using File = System.IO.File; namespace Newtonsoft.Json.Tests.Documentation { + public static class File + { + public static StreamReader OpenText(string path) + { + return null; + } + } + public class LinqToJsonTests { public void LinqToJsonBasic() @@ -218,14 +226,6 @@ namespace Newtonsoft.Json.Tests.Documentation #endregion } - public static class File - { - public static StreamReader OpenText(string path) - { - return null; - } - } - public void LinqToJsonReadObject() { #region LinqToJsonReadObject diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj index 90f04df7..6885929d 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj @@ -117,6 +117,7 @@ + diff --git a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs index 0bfd0208..9e36aa74 100644 --- a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs @@ -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.8.15212")] +[assembly: AssemblyFileVersion("4.5.8.15213")] #endif diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs index 06b63dfc..6750a2da 100644 --- a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs @@ -91,7 +91,7 @@ using System.Security; // by using the '*' as shown below: [assembly: AssemblyVersion("4.5.0.0")] #if !PocketPC -[assembly: AssemblyFileVersion("4.5.8.15212")] +[assembly: AssemblyFileVersion("4.5.8.15213")] #endif [assembly: CLSCompliant(true)]