如果我有一个为属性指定默认值的 JSON 模式,例如
{
"type" : "object",
"properties" : {
"foo" : { "type" : "string" },
"bar" : { "type" : "string", "default" : "some text" }
}
}
...和一个 JSON 字符串,如
{
"foo" : "lorem ipsum"
}
...我如何反序列化该 JSON 字符串,以便将bar
其设置为“某些文本”(默认值)而不是 null?