我正在尝试将此json转换为对象,它会给出错误;
{"ch":"RSNT_GUEST_DEV_2","m":"{"NEXT_TO_NOTIFY_GUEST_ID":-1,"OP":"DEL","totalWaitTime":72,"ORG_TOTAL_WAIT_TIME":72,"guestObj":-1,"NOW_SERVING_GUEST_ID":308,"FROM":"ADMIN","numberofparties":8,"nowServingParty":308,"orgid":2}"}
错误:
JSON异常 - {“ch”的字符33处的未终止对象:“RSNT_GUEST_DEV_2”,“m”:“{”NEXT_TO_NOTIFY_GUEST_ID“: - 1,”OP“:”DEL“,”totalWaitTime“:72 “ORG_TOTAL_WAIT_TIME”:72, “guestObj”: - 1, “NOW_SERVING_GUEST_ID”:308, “FROM”: “ADMIN”, “numberofparties”:8中, “nowServingParty”:308, “ORGID”:2}“}
答案 0 :(得分:0)
这是" {"问题改变你传递的格式错误
正确格式:
{
"ch": "RSNT_GUEST_DEV_2",
"m": [
{
"NEXT_TO_NOTIFY_GUEST_ID": -1,
"OP": "DEL",
"totalWaitTime": 72,
"ORG_TOTAL_WAIT_TIME": 72,
"guestObj": -1,
"NOW_SERVING_GUEST_ID": 308,
"FROM": "ADMIN",
"numberofparties": 8,
"nowServingParty": 308,
"orgid": 2
}
]
}
答案 1 :(得分:0)
这不是一个有效的json来检查json是否有效尝试JSON Lint
您的json响应应该是这样的
{
"ch": "RSNT_GUEST_DEV_2",
"m": {
"NEXT_TO_NOTIFY_GUEST_ID ":"-1,"
"OP":"DEL",
"totalWaitTime ":"72","ORG_TOTAL_WAIT_TIME ":"72",
"guestObj":"-1,
"NOW_SERVING_GUEST_ID":"308",
"FROM":"ADMIN ",
"numberofparties ":"8",
"nowServingParty":"308",
"orgid":2}
}
答案 2 :(得分:0)
您输入的Json数据无效,请确保您的数据
{
"ch": "RSNT_GUEST_DEV_2",
"m": {
"NEXT_TO_NOTIFY_GUEST_ID ": "-1",
"OP": "DEL",
"totalWaitTime ": "72",
"ORG_TOTAL_WAIT_TIME ": "72",
"guestObj": "-1",
"NOW_SERVING_GUEST_ID": "308",
"FROM": "ADMIN ",
"numberofparties ": "8",
"nowServingParty": "308",
"orgid": 2
}
}
使用此在线工具验证您的json数据http://www.jsoneditoronline.org/