以下json字符串未被解析,因为“orgId”:,不指定空值。有没有办法让json解析器接受这个或者这总是无效的?
200(OK) Content-Type:application / json
{
"orgId": ,
"orgName": "Department of JSON",
"orgProfile": {
"publicName": "",
"numHits": 29,
},
"orgDescript": {
"someOrgDescription": ""
}
}
答案 0 :(得分:2)
这是语法上无效的JSON。没办法解决它。如果要省略值,有两个选项:
{
"orgId": null,
"orgName": "Department of JSON",
"orgProfile": {
"publicName": "",
"numHits": 29
}
}
或
{
"orgName": "Department of JSON",
"orgProfile": {
"publicName": "",
"numHits": 29
}
}