Reputation: 201
I have a problem with JSON if our data has double quotes like this: " 15" " (15 inch).
JSON is not parsing it.
My code looks like this:
String strheader = convert.ToString(dt.table[0].rows[0]["Size"]);
Response.ContentType = "application/json; charset=utf-8";
Response.Write(strheader);
How can I solve this?
Upvotes: 0
Views: 1515
Reputation: 17804
Use a Json library like Json.NET or Simple Json for the task since them will escape your data automaticaly.
If it is just a simple task then just escape it manually like some have suggested
Upvotes: 1
Reputation: 53146
You need to escape it.
{ book: "How to code C++ in 24 hour steps", author: "O\"Reilly" }
Upvotes: 4