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 CodingAdvertisement
728x90
114of476