oshirowanen
oshirowanen

Reputation: 15925

Invalid JSON data

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 content section of the json data. How do I do this?

Upvotes: 0

Views: 533

Answers (2)

oshirowanen
oshirowanen

Reputation: 15925

Nevermind, I figured it out

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

replaces all " with \"

Upvotes: 0

Sang Suantak
Sang Suantak

Reputation: 5265

Use single quotes for the style attribute.

Upvotes: 3

Related Questions