JavaScript JSON

YanisaHS's avatar
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.

  • A full-stack engineer can get a project done from start to finish, back-end to front-end.
    • Includes 51 Courses
    • With Professional Certification
    • Beginner Friendly.
      150 hours
  • Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
    • Beginner Friendly.
      15 hours

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

Contribute to Docs

Learn JavaScript on Codecademy

  • A full-stack engineer can get a project done from start to finish, back-end to front-end.
    • Includes 51 Courses
    • With Professional Certification
    • Beginner Friendly.
      150 hours
  • Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
    • Beginner Friendly.
      15 hours