0 votes
in JSON by
What is the purpose JSON stringify?

1 Answer

0 votes
by

When sending data to a web server, the data has to be in a string format. You can achieve this by converting JSON object into a string using stringify() method.

var userJSON = { name: "John", age: 31 };
var userString = JSON.stringify(userJSON);
console.log(userString); //"{"name":"John","age":31}"

Related questions

0 votes
asked Jul 20, 2020 in JSON by Robindeniel
0 votes
asked Jan 5, 2021 in JSON by GeorgeBell
...