1

我正在使用 SBJson 来解析 JSON 字符串。有些请求会返回这样的想法:

{
"jsonResponse":[{  
"id":"2",  
"name":"Somename",  
"title":"Json problem:"ErrorParsing"", //problem is here. with double quotations. how to remove them or remove error? When i delete brackets before and after ErrorParsing, it works good.  
"otherinfo":"blabla",  
}]
}
4

3 回答 3

4

那些不是括号;它们是(双)引号/引号。在有效的 JSON 中,字符串中的引号必须用 \ 转义,例如“Hello \"World\"”。

您正在使用的 Web 服务正在返回无效的 JSON。

http://jsonlint.com是验证 JSON 字符串的有用资源。

于 2011-09-13T14:05:54.047 回答
1

我相信您的意思是“双引号”,而不是“双括号”。您需要在那里使用不同的引号,例如:

"title":"Json problem:'ErrorParsing'"
于 2011-09-13T14:02:16.310 回答
0

正确的json必须是

{
"jsonResponse":[{  
"id":"2",  
"name":"Somename",  
"title":"Json problem:\"ErrorParsing\"", //problem is here. with double quotations. how to remove them or remove error? When i delete brackets before and after ErrorParsing, it works good.  
"otherinfo":"blabla",  
}]
}

我想你明白了

于 2016-07-11T07:55:42.223 回答