How to convert an object into a JSON string in JavaScript

1 Answer

0 votes
const obj = { name: "Tom", age: 56, profession: "Developer" };
const json = JSON.stringify(obj);
 
console.log(json);
 
 
 
   
/*
run:
 
{"name":"Tom","age":56,"profession":"Developer"}
 
*/

 



answered Mar 20, 2020 by avibootz

Related questions

1 answer 155 views
1 answer 153 views
1 answer 178 views
1 answer 205 views
2 answers 244 views
1 answer 162 views
1 answer 157 views
...