How to parse a JSON string into an object and serialize (stringify) an object back to JSON in JavaScript. JSON.parse and JSON.stringify are built into every browser and Node.js — no library needed. Need to clean up the JSON first? Use the formatter & validator.
const obj = JSON.parse(text);
const text = JSON.stringify(obj, null, 2);
JSON.parse and JSON.stringify are built into every browser and Node.js — no library needed. Parse with the snippet above; the result is a native object/map you can read.
Use the stringify snippet above with indentation, or paste your JSON into the formatter on this page.