The formatted JSON shows here…
What is a JSON formatter?
A JSON formatter adds indentation and line breaks to JSON so that you can read it, and checks that the syntax is valid. You need one when an API response or a config file arrives as one long line, or when a parser rejects your JSON and you need to find the error.
How to format JSON
- Paste your JSON into the Input pane, or click Load Sample.
- Select the indent: 2 spaces, 4 spaces or a tab.
- Click Format, or press Ctrl+Enter.
- Click Minify if you need the JSON on one line.
- Click Copy.
Why is my JSON invalid?
The error shows the line and the column. These causes are the most common:
- A comma after the last item:
[1, 2, 3,] - Single quotes instead of double quotes:
{'a': 1} - Keys with no quotes:
{a: 1} - Comments (
//or/* */). JSON does not allow them. - A missing comma between two items.
Frequently Asked Questions
Is my JSON sent to a server?
No. Formatting and validation run in your browser. Your data stays on your device.
What is the difference between formatting and minifying JSON?
Formatting adds indentation and line breaks so that people can read the JSON. Minifying removes all spaces that are not necessary, so the JSON is as small as possible for a network or a config value.
Why does the validator say my JSON is invalid?
The most common causes are a comma after the last item, keys with no quotes, single quotes, and comments. JSON follows strict RFC 8259 syntax and allows none of these.
How large a JSON file can the tool format?
There is no fixed limit, because your browser does the work. Files of more than about 10 MB can be slow, depending on your device.
Does it support JSON5 or JSON Lines?
No. The tool checks strict JSON (RFC 8259). JSON5 (comments, trailing commas) and JSON Lines (one object per line) show as invalid.