Click or drag to resize
Json.NET Schema

Save JSON Schema to a file

 

This sample saves a JSchema to a file.

Sample
Usage
JSchema schema = new JSchema
{
    Type = JSchemaType.Object
};

// serialize JSchema to a string and then write string to a file
File.WriteAllText(@"c:\schema.json", schema.ToString());

// serialize JSchema directly to a file
using (StreamWriter file = File.CreateText(@"c:\schema.json"))
using (JsonTextWriter writer = new JsonTextWriter(file))
{
    schema.WriteTo(writer);
}