Reputation: 6132
I'm using CKEditor to allow our users to create content (text with tables, images etc). I then want to take whatever they've entered and pass it back to an ASP.Net web service using JSON.
I'm using JSON.stringify to convert my JSON object into a string and then sending it to the web service using JQuery ajax.
However when I try to convert the JSON string on the server using Newtonsoft.JSON I get an error as what's been passed isn't a valid JSON string. It seems to be an issue with line breaks and quotes in the HTML I'm passing, I could replace these before using JSON.stringify but my worry is that the user could enter practically anything. I was hoping JSON.stringify would correctly format my JSON but this doesn't seem to be the case. Is there something else I could use that would keep my JSON string valid?
Upvotes: 0
Views: 1614
Reputation: 6132
The following JSON parser solved my problem:
http://archive.plugins.jquery.com/project/json
also found at
http://code.google.com/p/jquery-json/
Upvotes: 1