JSON

Published Jun 2, 2022Updated Sep 29, 2022
Contribute to Docs

In JavaScript, the built-in JSON object is used to convert values to JavaScript Object Notation (JSON) as well as parse those values. JSON is a standard JavaScript object, so there is no need to import any external packages.

Syntax

JSON.staticMethod();

No constructor function is needed to create JSON objects. The .staticMethod() used against the JSON object is going to be either the .parse() or the .stringify() methods, shown below:

JSON

.parse()
Returns a new value taken from a provided JSON string.
.stringify()
Returns the string representation of a JSON object.

All contributors

Looking to contribute?

Learn JavaScript on Codecademy