Why do we use JSON.stringify() method in jQuery?

jQueryWeb DevelopmentFront End Technology

JSON or JavaScript Object Notation is a lightweight text-based open standard designed for human-readable data interchange. Use the JSON.stringify() method to convert a JavaScript object into a string.

You can try to run the following code to learn how to work with JSON.stringify() method −


Live Demo

<!DOCTYPE html>
<p id="test"></p>
<p>JSON string is created above</p>
  var v = { "name":"Amit", "Rank":1, "city":"India"};
  var newJSON = JSON.stringify(v);
  document.getElementById("test").innerHTML = newJSON;
Published on 31-Jul-2018 16:45:41