Timur Mustafaev
Timur Mustafaev

Reputation: 4929

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.  
"otherinfo":"blabla",  
}]
}

Upvotes: 1

Views: 1807

Answers (3)

rishad2m8
rishad2m8

Reputation: 1508

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

Upvotes: 0

user557219
user557219

Reputation:

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.

Upvotes: 4

Tim
Tim

Reputation: 60130

I believe you mean "double quotes," not "double brackets." You'll need to use different quotes there, so something like:

"title":"Json problem:'ErrorParsing'"

Upvotes: 1

Related Questions