Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

escape json in javascript

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. 
Comment

js json escape

JSON.parse(JSON.stringify(jsonObject));
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript get current date 
Javascript :: remove event listener jquery 
Javascript :: javascript date time 
Javascript :: uncaught TypeError: $.jajax is not a function 
Javascript :: shuffle an array of numbers in javascript 
Javascript :: c# write json to file 
Javascript :: how to use br tag in javascript string 
Javascript :: how to get href value of anchor tag in jquery in list 
Javascript :: reload page with parameters javascript 
Javascript :: js cut string after last char 
Javascript :: golang http POST JSON content 
Javascript :: play audio with js 
Javascript :: copy to clipboard angular 
Javascript :: capitalize first letter after character javascript 
Javascript :: access to static file nodejs 
Javascript :: jquery get selected dropdown item 
Javascript :: Putting password in a zip file using node.js 
Javascript :: jquery event keycode 
Javascript :: js random in range 
Javascript :: javascript to get uri 
Javascript :: luxon timestamp 
Javascript :: npm install global vs local 
Javascript :: js get random word from list 
Javascript :: push characters to a string javascript 
Javascript :: how to render a new page in node js through express 
Javascript :: generate random number between two numbers javascript 
Javascript :: change key in array of objects javascript 
Javascript :: puppeteer get attribute 
Javascript :: how to navigate programatically in class component react router v6 
Javascript :: Prevent Double Submit with JavaScript 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =