An API response or a config file often arrives as one long line. Before you can read it, or find out why a program rejects it, it has to be laid out with one value per line. The same step also tells you whether the text is valid JSON at all.
Steps
- Open JSON formatter.
- Paste the JSON into the box. The result appears as you type.
- Pick an Indent: 2 spaces, 4 spaces, Tabs, or Minify to remove all whitespace.
- Press Copy to take the result.
The text is parsed in your browser and is not sent anywhere, so a response that contains keys or customer data can be pasted safely.
When it reports an error
If the text is not valid JSON, the browser's own parser message is shown in place of a result, usually with the position where parsing stopped. The wording differs between browsers. The usual causes are:
- a comma after the last item of a list or object,
- single quotes where JSON requires double quotes,
- property names without quotes,
- comments, which JSON does not allow.
The tool validates syntax only. It does not check the data against a schema.
Sort keys A → Z
This option reorders the properties of every object alphabetically, at all nesting levels. Lists keep their order. With Minify, {"b":1,"a":[3,1]} becomes {"a":[3,1],"b":1}. Sorting is useful before comparing two versions of a file: format both the same way, then paste them into Compare two texts, and only real changes show up.
Two things that change silently
- Very large numbers are rounded. The value 12345678901234567890 comes out as 12345678901234567000, because the browser stores numbers with about 15 to 17 significant digits. Identifiers that long are only safe as strings.
- Duplicate property names collapse. If an object contains the same key twice, only the last value is kept.
To turn a list of objects into a spreadsheet, continue with JSON to CSV.