Free JSON formatter and validator
JSON Formatter
Readable JSON in one click.
Paste or open JSON, then format, minify, validate or fix it. Sort keys or switch to a tree view, and in most browsers errors show the line and column where the JSON breaks.
Free, no sign-up. Errors show the line and column in most browsers.
- { }Format, fix, sortIndent, sort keys, fix commas
- ▸Text or treeCollapse big objects
- OnNot uploadedFiles open in this browser
Format is off until the JSON is valid. Validate shows where it breaks, and Fix JSON can repair common mistakes.
/json-formatter
How it works
Paste or open, pick an indent, then format, validate, and copy or download.
- 1
Paste or open
Paste JSON, or open a .json file.
- 2
Indent
Pick 2 spaces, 4 spaces or Tab, and turn on Sort keys if you want keys in A to Z order.
- 3
Format or validate
Click Format to pretty-print, Beautify for a 2-space indent, or Validate to check the JSON.
- 4
Fix or explore
Fix JSON repairs trailing commas and quotes. The tree view lets you collapse big objects.
- 5
Copy
Copy the output or download it as formatted.json.
Frequently Asked Questions
Formatting, fixing and where your JSON goes.
How do I format JSON online?
Paste or open your JSON, pick 2 spaces, 4 spaces or Tab, and click Format. The result appears in the output box, ready to copy or download.
Is my JSON uploaded?
No. It is parsed and formatted by code that runs in your browser on this page, and it is not sent to NixRey. Files you open are read the same way, and the tool doesn't save your JSON in the browser.
How do I validate JSON?
Click Validate. Valid JSON shows "Valid JSON." If there is a mistake, most browsers show the line and column, and Jump to error moves the cursor there.
Why is Format greyed out?
The input is empty or is not valid JSON yet. Click Validate to see where it breaks, then fix it by hand or try Fix JSON. Format turns back on once the JSON is valid.
Does it accept comments or trailing commas?
It follows standard JSON, so comments and trailing commas show as errors. Fix JSON can remove trailing commas, but it leaves comments alone, so remove those by hand.
What is the difference between Format, Beautify and Minify?
Format uses the indent you picked. Beautify always uses 2 spaces. Minify removes spaces and line breaks so the JSON is as small as possible, without changing the values.
Can I save the output?
Yes. Click Copy to put it on your clipboard, or Download to save it as formatted.json.
What does Fix JSON change?
Only a few common mistakes, namely trailing commas, single quotes and keys without quotes. It lists every change it made, so check the result before you copy it.
What does Sort keys do?
It orders the keys in every object from A to Z when you format, which makes two configs easier to compare. Arrays keep their order.
What is the tree view?
It is a read-only outline of your JSON. Click an object or array to collapse or expand it, or use Expand all and Collapse all. To edit, switch back to Text.
Can I open a JSON file?
Yes. Open a .json, .txt, .geojson or .map file. It is read in your browser and is not sent to a NixRey server.