← Back to Roadmap

JSON

Easy

In plain terms

JSON is a text format for data exchange. JSON.stringify() converts object to string. JSON.parse() converts string to object. Used for APIs and storage.

What you need to know

  • stringify, parse
  • No functions or undefined
  • Common for APIs

Try it yourself

Copy the code below and run it in your browser console or a code editor:

const obj = { name: 'Alice', age: 25 };
const str = JSON.stringify(obj);  // '{"name":"Alice","age":25}'
const parsed = JSON.parse(str);   // { name: 'Alice', age: 25 }

Learn more

Dive deeper with these trusted resources: