Q:

node json stringify

var person={"first_name":"Tony","last_name":"Hawk","age":31};
var personJSONString=JSON.stringify(person); 
27
let data = {
  name: "John Smith",
  age: 30,
  hobbies: ["Programming", "Video Games"]
};

// {name:"John Smith",age:30,hobbies:["Programming","Video Games"]}
let miny = JSON.stringify(data);

// The 4 parameter signifys 4 spaces. You can also use "\t".
/* {
 *     name: "John Smith",
 *     age: 30,
 *     ...
 */
let pretty = JSON.stringify(data, null, 4);
4
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]
3

New to Communities?

Join the community