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 228 views
1 answer 227 views
1 answer 252 views
1 answer 296 views
2 answers 373 views
1 answer 233 views
1 answer 239 views
...