1var myJSONString = JSON.stringify(myJSON);
2var myEscapedJSONString = myJSONString.replace(/\\n/g, "\\n")
3 .replace(/\\'/g, "\\'")
4 .replace(/\\"/g, '\\"')
5 .replace(/\\&/g, "\\&")
6 .replace(/\\r/g, "\\r")
7 .replace(/\\t/g, "\\t")
8 .replace(/\\b/g, "\\b")
9 .replace(/\\f/g, "\\f");
10// myEscapedJSONString is now ready to be POST'ed to the server.
11