Click or drag to resize
Json.NET Schema

Parse JSON Schema from JSON

 

This sample parses a JSchema from JSON

Sample
Usage
string schemaJson = @"{
  'description': 'A person',
  'type': 'object',
  'properties': {
    'name': {'type':'string'},
    'hobbies': {
      'type': 'array',
      'items': {'type':'string'}
    }
  }
}";

JSchema schema = JSchema.Parse(schemaJson);

Console.WriteLine(schema.Type);
// Object

foreach (var property in schema.Properties)
{
    Console.WriteLine(property.Key + " - " + property.Value.Type);
}
// name - String
// hobbies - Array