【发布时间】:2017-09-22 10:28:06
【问题描述】:
我有一个 MVC 应用程序,它将我的模型序列化为 json 模式(使用 Newtonsoft json.net 模式)。问题是我数组中的项目类型为["string", "null"],但我需要的只是"string"。这是我的课程的代码:
public class Form
{
[Required()]
public string[] someStrings { get; set; }
}
这是由 Json.net 架构制作的架构:
"someStrings": {
"type": "array",
"items": {
"type": [
"string",
"null"
]
}
}
虽然我期待这个:
"someStrings": {
"type": "array",
"items": {
"type": "string"
}
}
请帮我摆脱那个“空”。
【问题讨论】:
标签: c# .net json json.net jsonschema