InterviewHubPRO
Section Overview
Q118

Question 118 of 521

Part 3: DOM, Event Flow, Timers & Browser APIs (104 - 173)

23%
JavaScript Internals (521 Qs)•Part 3: DOM, Event Flow, Timers & Browser APIs (104 - 173)

What is the purpose JSON stringify

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
  var userJSON = { name: "John", age: 31 };
  var userString = JSON.stringify(userJSON);
  console.log(userString); //"{"name":"John","age":31}"