Click or drag to resize
Json.NET Schema

Generate with ContractResolver

 

This sample generates a new JSchema with a IContractResolver.

Sample
Types
public class Person
{
    public string Name { get; set; }
    public int Age { get; set; }
}
Usage
JSchemaGenerator generator = new JSchemaGenerator();

// change contract resolver so property names are camel case
generator.ContractResolver = new CamelCasePropertyNamesContractResolver();

JSchema schema = generator.Generate(typeof(Person));
// {
//   "type": "object",
//   "properties": {
//     "name": {
//       "type": [ "string", "null" ]
//     },
//     "age": { "type": "integer" }
//   },
//   "required": [ "name", "age" ]
// }