JSON Formatter
json-format• Beautify JSON with indentation or minify it to a single line. • Choose indent (2·4·tab), see error positions, and copy the result.
Parses your JSON and either beautifies it with indentation or minifies it to a single line. Strings, numbers, and nested structures are preserved; errors show the position.
Why format JSON?
JSON works fine without line breaks or indentation, so the JSON in an API response or a log line usually arrives as one long line. To read the structure, a human needs it broken up to match the nesting.
Pretty mode adds indentation so you can see at a glance which value belongs where. Minify mode strips every space to reduce transfer size. A good habit is formatted for config files, minified for request bodies.
If the syntax is invalid you get the error position too, which makes finding a trailing comma or a missing quote much faster. Pasted JSON is processed only in your browser and never sent to a server, so real response data is safe to paste.
Frequently asked questions
How do I find where the JSON error is?
The input is checked as you paste, and when it fails the browser error is shown as-is along with a position number. That number is a character offset from the start of the document, so jumping to it in your editor lands you on the spot. The real cause is often a line or two earlier.
Why does one trailing comma break the JSON?
The JSON standard does not allow a comma after the last item in an array or object. JavaScript source accepts it, so it is easy to leave one behind, but here it is reported as an error. Deleting an entry and forgetting its comma is the usual cause, so check just before the closing bracket.
Why are single quotes and comments not allowed?
Strings and keys must be wrapped in double quotes, and comments starting with two slashes or a star are not part of JSON. Pasting a Python dict or an annotated config file usually trips on exactly these two. Swap the quotes and strip the comment lines and it parses.
Non-ASCII text shows up as unicode escapes
API responses and logs often encode non-ASCII characters as backslash-u sequences. Paste that in and parsing turns them back into the original characters, so the output shows readable text. Only the notation changes, not the value, so the result is safe to use as is.
When should I minify JSON?
Minify strips every line break and space so the document fits on one line. It is handy for putting a config value into a single environment variable, pasting a request body into a command line, or cutting storage and transfer size. The values are unchanged, so you can expand it again later.
Should I use 2 spaces, 4 spaces or tabs?
The data is identical either way, so follow your team convention. Two spaces are common in web projects, while four read better in shallow config files. Tabs let each reader set their own width, which works well when pasting into docs or issues.