JSON Formatter & Validator
Format, validate, minify and repair JSON without leaving your browser.
- Free
- No sign-up
- Runs in your browser
Updated
Paste or upload JSON to start.
What is it?
A JSON formatter turns compact or messy JSON into indented, readable text and flags syntax errors. This one validates as you type, formats with 2 or 4 spaces, minifies, sorts keys, shows a collapsible tree view, and repairs common mistakes with Auto-fix. Everything runs in your browser, so your JSON is never uploaded.
How to use
- Paste JSON into the input pane, press Upload, or drop a .json or .txt file onto the page.
- Check the status bar: it reads Valid JSON or shows the parser error, with an Auto-fix button when the input can be repaired.
- Pick 2 or 4 spaces, then press Format (or ⌘/Ctrl + Enter in the input) to prettify, or Minify to collapse it to one line.
- Optionally press Sort Keys, switch the output view to Tree, or open Stats.
- Press Copy or Download to save the result as formatted.json.
Frequently asked questions
Is my JSON sent to a server?
No. Parsing, formatting, repair and file loading all run in JavaScript in your browser, and the tool makes no network requests with your data. It is safe to paste API responses or config files that contain secrets.
Why is my JSON invalid?
The most common causes are a trailing comma after the last item, single-quoted strings, unquoted keys, comments, or values like undefined and NaN, none of which strict JSON allows. Press Auto-fix to repair most of these in one step.
How do I fix invalid JSON automatically?
Paste it in; if the status bar shows an Auto-fix button, press it. The tool rewrites the input as valid JSON and formats the result, but check it afterwards since a repair is a best guess.
What is the difference between JSON and JSON5?
JSON5 is a looser superset that allows comments, trailing commas, single quotes and unquoted keys. This tool validates strict JSON, but Auto-fix can usually convert JSON5-style input into strict JSON.
How do I minify JSON?
Paste valid JSON and press Minify. All whitespace and line breaks are removed so the output is a single line, ready to copy or download.
Does Sort Keys change my data?
No values change. Object keys are reordered alphabetically at every level, and arrays keep their original order, which makes two payloads easier to compare.
Can I open a JSON file from my computer?
Yes. Press Upload or drag a .json or .txt file anywhere onto the page; the file is read locally and formatted straight away.