var myJSONString = JSON.stringify(myJSON);
var myEscapedJSONString = myJSONString.replace(/
/g, "
")
.replace(/'/g, "'")
.replace(/"/g, '"')
.replace(/&/g, "&")
.replace(/
/g, "
")
.replace(/ /g, " ")
.replace(//g, "")
.replace(/f/g, "f");
// myEscapedJSONString is now ready to be POST'ed to the server.
JSON.parse(JSON.stringify(jsonObject));