JSON: how to deal with double quotations?
I'm using SBJson to parse by JSON string. Some requests return somethink like this:
{
"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.
"otherin开发者_C百科fo":"blabla",
}]
}
Those aren’t brackets; they’re (double) quotes/quotation marks. In valid JSON, quotation marks inside strings must be escaped with \, e.g. "Hello \"World\"".
The Web service you’re using is returning invalid JSON.
http://jsonlint.com is a useful resource to validate JSON strings.
I believe you mean "double quotes," not "double brackets." You'll need to use different quotes there, so something like:
"title":"Json problem:'ErrorParsing'"
Correct json must be
{
"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",
}]
}
I think you got the point
精彩评论