JavaScript 2025 · Objects and data

Convert to and from JSON

Pretty-print an object as JSON, and parse JSON text back.

const text = JSON.stringify(data, null, 2);
const parsed = JSON.parse(text);

Official JavaScript 2025 documentation

More objects and data commands

All objects and data commands · JavaScript 2025 cheatsheet

Was this page helpful?