What valid JSON looks like
JSON is defined by RFC 8259 and has six kinds of value: objects in braces, arrays in square brackets, strings, numbers, booleans and null. Object keys must be strings in double quotes, strings may only use double quotes, and items are separated by commas with none after the last. A document is a single value, usually an object or an array, though a bare number or string is valid too and this tool accepts it.
The format is stricter than the JavaScript it came from. Comments are not allowed. Numbers cannot have leading zeros, a plus sign in front or a bare decimal point. Inside a string, a line break or tab must be written as an escape such as \n or \t, and a backslash may only be followed by a double quote, another backslash, a slash, one of the letters b, f, n, r or t, or u plus four hex digits.
Reading the error message
When parsing fails, the tool runs its own scanner over the text to find the exact position, because browsers do not reliably say where a JSON error is. The result is a line and column counted from 1, a message, and the source line with a caret under the column. The position is where the parser gave up, which is sometimes just after the real mistake: a missing comma is reported at the start of the next item.
Unexpected followed by a character usually points at a word JSON does not have. Python's True, False and None, JavaScript's undefined and NaN, and unquoted text all end up here. The fix is the JSON spelling (true, false, null) or a pair of double quotes.
- Trailing comma before '}' or ']': delete the comma after the last item.
- Expected a double-quoted property name: a key is unquoted or in single quotes.
- Expected ',' or '}' after property value: a comma is missing, or a comment follows the value.
- Unescaped control character in string: a raw line break or tab sits inside quotes.
- Unexpected content after the JSON value: two documents were pasted together.
Beautify, minify and sort
Beautify writes the parsed value out with one key or item per line and the indentation you chose. Minify removes every optional space and line break, which is the form to send over a network or store in a database column. Both hold the same data. Only whitespace differs.
Sort keys orders the keys of every object alphabetically, at every depth, and leaves arrays alone because array order carries meaning. Sorting is by character code, so capital letters come before lower-case ones. It makes two versions of a config or API response line up for a diff, since objects that differ only in key order become identical text.
What reformatting changes in your data
The output is not the input with new spacing. It is the parsed value written out again by the browser's JSON serialiser. For most documents the difference is invisible, but a few things change. Whole numbers beyond 9007199254740991 lose precision, so 9007199254740993 comes back as 9007199254740992. 1.0 becomes 1 and 1e3 becomes 1000. A duplicated key keeps only its last value.
Escapes are normalised as well: \u00e9 is written out as the accented letter itself and \/ as a plain slash. Keys that look like non-negative integers move to the front of their object in numeric order, a rule of JavaScript objects that applies even with Sort keys off. If 64-bit IDs must survive exactly, they have to be strings in the source data.
Limits and related tools
The tool checks syntax only. It does not validate against a JSON Schema, does not accept JSON5 or JSON with comments, and does not repair broken input for you. There is no size cap in the code, but the document is parsed again on every keystroke, so a very large file is easier to paste once than to edit in place.
To decode a Base64 payload before formatting it, such as the middle section of a JWT, use Base64 Encoder / Decoder with the URL-safe option. To compare two files by checksum instead of by eye, MD5 Generator hashes both text and files.