Tools › Data
JSON Format
Indent JSON with 2 or 4 spaces or tabs, minify it, or show it as a collapsible tree; repair loose JSON, sort its keys, and pick out values with a JSONPath query.
About this tool What it's for, how to use it and an example
What it's for
Make JSON readable, make it compact, or explore it as a tree. It also checks that the JSON is valid and tells you where it isn’t.
For example, when an API returns one enormous line of JSON, prettify it to read it, or use the tree to find one value deep inside a large response.
How to use it
Paste JSON, choose an indent (2 or 4 spaces, or tabs), then:
- Prettify lays it out with one value per line.
- Minify removes all unnecessary spaces and line breaks, for the smallest output.
- Tree shows it as a collapsible outline, with the size of each object and array. Use Expand all and Collapse all to move around.
JSON that’s almost right is repaired first, and the message says what was fixed: comments, trailing commas,
single-quoted strings, keys without quotes, and Python’s True, False and None. Tick Sort keys to put
every object’s keys in alphabetical order (remembered). Type a JSONPath query such as
$.items[?(@.price < 10)].name to keep only the matching values: .name, ['name'], [0], [-1], [*],
[0:3], ..name (at any depth) and filters with ==, !=, <, <=, > and >= work.
If the JSON can’t be repaired, the error message gives the line and column of the problem.
Example
Paste this and choose Prettify:
{"name":"Alice","tags":["admin","dev"],"active":true}
The result has each key on its own line, indented by 2 spaces. Delete the last } and try again: the tool
reports the error instead.
Good to know
Repair handles the common slips, not every mistake: a missing comma or bracket is still an error. The JSONPath support covers the everyday parts of the standard, not functions such as length(). Very large numbers may lose precision, as they do in JavaScript.
Private: this tool runs in your browser. Nothing you type, paste or choose leaves this page.
Saved you a few minutes? Say thanks with a coffee.
Something wrong with this tool, or missing from it? Report a bug or suggest a feature.