JSON Formatter and Validator
Private: nothing leaves your browser
Waiting for JSON
Paste any JSON to pretty print it with proper indentation, or minify it back to a single line. If it will not parse, you get the exact line and column that broke, and it all happens on your own device.
About this JSON formatter
Badly wrapped JSON is hard to read and harder to debug, and most online formatters make you upload your payload to somebody else's server before they will help. This one is plain JavaScript running on this page, so API responses, config files and anything with a token in it stay on your own machine. Nothing is uploaded, logged or stored, and the page keeps working with your connection switched off.
Formatting changes whitespace, and nothing else except numbers: key order, strings and booleans come back out exactly as they went in. Numbers are read and written again, so a very long integer loses its last digits, which matters if your JSON carries IDs rather than quantities. When JSON will not parse, the status line names the problem and the line and column to look at, which is usually a trailing comma, a single quote or a stray comment. If what you want is a version you can comment and edit by hand, the same paste goes through the JSON to YAML converter.
Two things a formatter cannot fix, and both look like bugs in the formatter. Large integers lose precision, because JavaScript parses every number as a 64 bit float: an ID written as 9007199254740993 comes back as 9007199254740992, and anything above 253 is at risk. IDs that large should be sent as strings, and this page is where you find out that yours are not. Duplicate keys are the other one: two "id" keys in the same object is legal JSON, but only the last survives parsing, so one of them disappears without a warning from any parser. Both are properties of JSON itself rather than of this page, and both are worth knowing before you paste a payload into a bug report.
How to format and validate JSON
- Paste your JSON into the left box, or drag a
.jsonfile onto it. - Pick Format for readable output or Minify for the smallest single line.
- Choose the indent you prefer: two spaces, four spaces or a tab.
- Check the status line. If something is wrong it names the line and column to fix.
- Press Copy to put the result on your clipboard.
Common questions about JSON formatting
Is it safe to paste an API response with real data in it?
Is this a JSON viewer, a beautifier or a validator?
Why is my JSON invalid when it looks correct?
NaN and undefined. Strict JSON allows none of those. The status line points at the exact line and column so you can find it fast.
Does formatting change my data?
How large a file can it handle?
Next