How to format JSON
- Paste your JSON into the top box.
- It is checked and formatted automatically. A green message means it is valid.
- Choose Beautify for readable output or Minify for a single compact line.
- Copy the result or download it as a .json file.
If the JSON has an error, the message tells you roughly where it is, for example "near line 4, column 12". Look just before that spot, as the real mistake is often one character earlier.
Fixing common errors
| Wrong | Right |
|---|---|
{'name': 'Sam'} | {"name": "Sam"} |
{name: "Sam"} | {"name": "Sam"} |
[1, 2, 3,] | [1, 2, 3] |
{"ok": True} | {"ok": true} |
{"note": undefined} | {"note": null} |
What is JSON?
JSON (JavaScript Object Notation) is a plain text format for storing and sending structured data. It is used by nearly every web API, many config files and lots of databases. It has only six kinds of values: strings in double quotes, numbers, true, false, null, plus arrays in square brackets and objects in curly braces. That simplicity is why it took over from XML for most web work.
Tips
- Use Sort keys before comparing two JSON files. With the keys in the same order, the differences jump out.
- Browsers can be slow with huge files. For JSON over about 50 MB, a command line tool like
jqis a better fit.