input
JSON Formatter & Validator
Paste JSON to beautify it with a pretty print at the indent you choose, or minify it to a single line for a request body. The JSON validator lints the text as you type and names the line and column where parsing stopped. Everything runs in your browser; nothing is uploaded.
Format:
Frequently asked questions
How do I format or beautify JSON?
Paste the JSON into the input box and it is re-indented as you type, with nesting laid out one level per step so you can see the structure. Minify collapses it back to a single line with no whitespace, which is the form you want in a request body or a config value. Validate confirms the document in a message, in case you want the explicit answer rather than the formatted output.
Can I change the indentation or sort the keys?
Yes. Pretty output can be indented with two spaces, four spaces or a tab, and Sort keys orders every object’s keys alphabetically at every depth, which makes two documents with the same content line up for a diff. Arrays are never reordered, since in JSON their order is part of the data.
Why is my JSON invalid?
Almost always one of five things: a trailing comma after the last item, single quotes instead of double quotes, unquoted object keys, a comment, or a stray NaN, undefined or Infinity. All are legal JavaScript and none are legal JSON. The error shown is the browser’s own parser message, with the line and column added whenever the browser reports where it gave up, so start there and work outwards.
What is the difference between formatting and validating?
Validating answers whether the text is JSON at all; formatting changes how it is laid out. They happen together here, because a parser has to read the whole document before it can re-print it — if you get formatted output, the document was valid by definition.
Does formatting change my data?
Not the values, with the exceptions every JavaScript-based formatter shares. Numbers are re-printed in their shortest form, so 1.0 comes out as 1 and 1e2 as 100; an integer above 9007199254740991 (2^53 − 1) is rounded, and the tool warns you under the output when the input holds one; a key that appears twice in the same object keeps only its last value; and keys that look like whole numbers are listed first, in numeric order. Keys, strings, booleans and nesting come through exactly as they were.
Can it handle a large JSON file?
A few megabytes is fine on a normal machine, since the work is a single native parse and re-serialise. Very large documents — tens of megabytes — will make the browser tab work hard, because the whole structure has to be held in memory at once; for those, a streaming tool such as jq is the better instrument.
Is my JSON uploaded to a server?
No. The whole tool is JavaScript running in your own browser, so nothing you type or paste is sent over the network, written to a log or attached to an analytics event. You can confirm it by opening the network tab and watching it stay empty while you work.
