JS Coding Questions Logo
JS Coding Questions
#114💼 Interview💻 Code

What is the purpose JSON stringify

Advertisement

728x90

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.

javascript
1var userJSON = { name: "John", age: 31 };
2
3var userString = JSON.stringify(userJSON);
4
5console.log(userString); //"{"name":"John","age":31}"

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 30

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
114of476