Click or drag to resize
Json.NETParse JSON Schema from JSON
 

This sample parses a JsonSchema from JSON

Caution note Caution

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

Sample
Usage
 1string schemaJson = @"{
 2  'description': 'A person',
 3  'type': 'object',
 4  'properties': {
 5    'name': {'type':'string'},
 6    'hobbies': {
 7      'type': 'array',
 8      'items': {'type':'string'}
 9    }
10  }
11}";
12
13JsonSchema schema = JsonSchema.Parse(schemaJson);
14
15Console.WriteLine(schema.Type);
16// Object
17
18foreach (var property in schema.Properties)
19{
20    Console.WriteLine(property.Key + " - " + property.Value.Type);
21}
22// name - String
23// hobbies - Array