doctor069
asked on
asp .net with JSON string
Hi -
I have a string that is stored in the format of JSON
i.e {"comment": "Hello this is a comment"}
I grad the string on the server and send it to jquery to parse.
Everything works great until a someone make a comment like this...
- Hello this is a *comment* - i say "this is fun"
This really messes with my JSON string on the front end
Is there a simple way to encode a JSON string?
Thanks
I have a string that is stored in the format of JSON
i.e {"comment": "Hello this is a comment"}
I grad the string on the server and send it to jquery to parse.
Everything works great until a someone make a comment like this...
- Hello this is a *comment* - i say "this is fun"
This really messes with my JSON string on the front end
Is there a simple way to encode a JSON string?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>Thanks but I am not using the NetJSON
why << but >> ?
you need to put a backslash for each reserved character for example with replace : http://msdn.microsoft.com/en-us/library/fk49wtc1.aspx
http://www.apacheserver.net/q25415/Replace-double-quotes-in-json-string-with-empty-string
why << but >> ?
you need to put a backslash for each reserved character for example with replace : http://msdn.microsoft.com/en-us/library/fk49wtc1.aspx
http://www.apacheserver.net/q25415/Replace-double-quotes-in-json-string-with-empty-string
ASKER
Downloaded Newtonsoft.Json.Net20.dll and I am using:
Json.JsonConvert.Serialize Object(mys tring)
Everything seems to work unless I have a word like don't or shouldn't
I thought SerializeObject would handle the ' an I missing something?
Json.JsonConvert.Serialize
Everything seems to work unless I have a word like don't or shouldn't
I thought SerializeObject would handle the ' an I missing something?
ASKER
a little short in the solution
ASKER