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 :: react propthpes or 
Javascript :: db.json code 
Javascript :: map javascript 
Javascript :: trim a string in javascript 
Javascript :: trigger a button click with javascript on the enter key in a text box 
Javascript :: javascript color green to red 
Javascript :: mongoose bulk update 
Javascript :: export socket io connection 
Javascript :: get width of screen 
Javascript :: js add query param 
Javascript :: gym open ai 
Javascript :: how to pick date from datepicker in selenium 
Javascript :: javascript iterate through an object 
Javascript :: deno vs nodejs 
Javascript :: nested include sequelize 
Javascript :: odd number is javascript 
Javascript :: javascript add parameter to object 
Javascript :: remove object from array javascript 
Javascript :: JavaScript array to URL params 
Javascript :: nuxtjs loading 
Javascript :: generate unique random number in javascript 
Javascript :: settimeout js 
Javascript :: js error handling 
Javascript :: javascript player movement 
Javascript :: module.exports in js 
Javascript :: js objects 
Javascript :: usecontext hook 
Javascript :: axios js 
Javascript :: form contact 7 ajax send 
Javascript :: 100 day javascript challenge 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =