The .stringify() method returns a string representation of a given JSON object. It is one of two methods that belong to the reserved JSON object, the other being the .parse() method.



The jsonObject must be valid. Otherwise, a SyntaxError is thrown.


In the example below, a valid JSON object is stored in a variable, myJSONObject, and then passed into the .stringify() method as an argument:

let myJSONObject = {
Hello: 'World',

The output will look like this:


Codebyte Example

The following example further demonstrates how the .stringify() method works:

Edit this page on GitHub


Interested in helping build Docs? Read the Contribution Guide or share your feedback form.

Learn JavaScript on Codecademy