开发者

Invalid JSON data

开发者 https://www.devze.com 2023-02-08 19:17 出处:网络
I have the following jquery which is invalid: { \"id\": 12, \"heading\": \"heading goes here 3\", \"content\": \"<p><span style=\"color: #ff0000;\">content</span> <u><stron

I have the following jquery which is invalid:

{
    "id": 12,
    "heading": "heading goes here 3",
    "content": "<p><span style="color: #ff0000;">content</span> <u><strong>goes </strong></u><span style="color: #ffffff;"><span style="background-color: #ff0000;">here</span></span> 3.</p>"
}

I am generating this with asp.net (vb.net) from data stored in a database. I think I need to somehow escape the double quotes within the c开发者_JAVA技巧ontent section of the json data. How do I do this?


Use single quotes for the style attribute.


Nevermind, I figured it out

mystring.replace("""","\""")

replaces all " with \"

0

精彩评论

暂无评论...
验证码 换一张
取 消