Click or drag to resize
Json.NET

Load JSON Schema from a file

 

This sample loads a JsonSchema from a file.

Caution note Caution

Obsolete. JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.

Sample
Usage
// read file into a string and parse JsonSchema from the string
JsonSchema schema1 = JsonSchema.Parse(File.ReadAllText(@"c:\schema.json"));

// read JsonSchema directly from a file
using (StreamReader file = File.OpenText(@"c:\schema.json"))
using (JsonTextReader reader = new JsonTextReader(file))
{
    JsonSchema schema2 = JsonSchema.Read(reader);
}