【发布时间】:2015-02-25 23:38:11
【问题描述】:
我正在尝试使用 JSON 模式验证。我在JSON.NET Help page 上使用架构的基本示例。我得到了例外
System.MethodAccessException: Attempt by method
'Newtonsoft.Json.Schema.JSchema.Parse(System.String)' to access method
'Newtonsoft.Json.Utilities.ValidationUtils.ArgumentNotNull(System.Object, System.String)' failed
我的代码在下面
[TestMethod]
public void prettySimple()
{
string schemaJson = @"{
'type': 'object',
'properties': {
'name': {'type':'string'},
'hobbies': {
'type': 'array',
'items': {'type':'string'}
}
}
}";
JSchema schema = JSchema.Parse(schemaJson);
}
【问题讨论】:
-
你引用的是
Newtonsoft.Json.Schema吗? -
是的,我是。还引用 Newtonsoft.Json.Schema
标签: c# json json.net jsonschema