I've copied a sample from the site https://www.newtonsoft.com/jsonschema/help/html/ValidatingJson.htm:
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Schema;
...
string schemaJson = @"{
'description': 'A person',
'type': 'object',
'properties': {
'name': {'type': 'string'},
'hobbies': {
'type': 'array',
'items': {'type': 'string'}
}
}
}";
JSchema schema = JSchema.Parse(schemaJson);
JObject person = JObject.Parse(@"{
'name': 'James',
'hobbies': ['.NET', 'Blogging', 'Reading', 'Xbox', 'LOLCATS']
}");
bool valid = person.IsValid(schema);
// true
When I try to debug it in VS2019 I get an exception: "Method not found: 'Boolean Newtonsoft.Json.Schema.SchemaExtensions.IsValid"
I feel so stupid for asking, but what am I doing wrong?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…