JSON Formatter
Put a JSON string in the JSON box and click Format. Valid input is parsed then re-serialized with two-space indentation. Invalid input shows Invalid JSON plus the parser message instead of pretty output.
Updated 2026-08-03 · developer
About this tool
Format runs JSON.parse on the textarea, then JSON.stringify with a null replacer and indent 2. The result area starts with Click Format and updates only when you press the button—so you can edit freely before committing a format pass.
How to use
- Paste JSON: Enter or paste your JSON into the JSON textarea.
- Click Format: Press Format to parse and pretty-print with two-space indent.
- Read the result: Use the indented output, or read the Invalid JSON error if parsing failed.
- Fix and retry: Correct syntax problems in the JSON box, then click Format again.
Common use cases
- Expand a one-line API response so nested keys are readable.
- Spot a missing comma or quote when the Invalid JSON message names the problem.
- Normalize spacing before committing a config file to git.
Tips
- Click Format after edits; the result does not auto-update while you type.
- If you see Invalid JSON, fix the reported syntax issue and Format again.
FAQ
How much indentation is used?
Successful formatting uses two spaces per level via JSON.stringify indent 2.
What happens on bad JSON?
The result shows Invalid JSON followed by the error message from the parser.
Does Format run automatically?
No. You must click Format; typing alone leaves the previous result unchanged.
Is my JSON sent anywhere?
No. Parsing and stringifying happen in the browser on this page.