stringify json element javascript code example
Example 1: how to use json stringify in javascript
var Num=[1,2,3,4,5,6]
console.log("The Numbers Are "+JSON.stringify(Num))
//output= The Number Are [1,2,3,4,5,6]
Example 2: javascript json stringify indented
JSON.stringify({a:1,b:2,c:{d:1,e:[1,2]}}, null, 4); // Indented 4 spaces
JSON.stringify({a:1,b:2,c:{d:1,e:[1,2]}}, null, "\t"); // Indented with tab