How to use it
- Paste your JSON into JSON text. The result is checked as you type.
- Choose an Indentation, or No spaces (minified) to make the text as short as possible.
- Tick Sort keys A to Z if you want the names in each object in alphabetical order.
- Read Validity. If it names a line and column, fix the text there. When it says valid JSON, copy the Formatted JSON.
How the JSON is checked and formatted
JSON is defined by RFC 8259. A text is valid when it holds one value, usually an object or an array, and every name is in double quotes. The tool asks the browser's own JSON parser whether the text is valid, so a valid result means what it means in your programs.
When the text is valid, the tool reads it again and writes it out with the indentation you chose. Only the spaces, tabs and line breaks between the tokens change. Names, strings and numbers are written exactly as you typed them.
- Two spaces, four spaces and a tab make the nesting easy to read. Empty objects and arrays stay on one line as {} and [].
- No spaces (minified) removes every space and line break, which makes the text shorter for a request or a settings value.
- Sort keys A to Z changes the order of the names inside each object. It never changes the order of the items in an array, because that order is part of the data.
What is kept, and what the errors mean
Numbers are not rounded. A value such as 12345678901234567890 or 1.50 is written back as you typed it. Many programs read a number that long with less precision, which is why the original text is kept.
The position in an error is the first character where the text stops being JSON. A comma after the last item, a single quote where a double quote belongs and a missing comma between two items are the most common causes. The tool does not repair the text: it shows where the problem is and leaves your text unchanged.
Worked example: the default JSON
The default text is one object with five names. The list inside it is one level deeper, so the nesting depth is 2. The validity check says Valid JSON, and the formatted text uses two spaces for each level.
With Sort keys A to Z ticked, the same five names come out as free, license, name, tags and version. The list of tags keeps its order: json, csv, yaml.
| Result | Default text | With Sort keys A to Z |
|---|---|---|
| Validity | Valid JSON | Valid JSON |
| Names (keys) | 5 | 5 |
| Nesting depth | 2 | 2 |
Frequently asked questions
What is the difference between formatting and validating JSON?
Validating checks that the text follows the JSON grammar. Formatting changes only the spaces and line breaks, so the data stays the same. This tool does both, and an invalid text is never formatted.
Why does the tool show a line and a column?
They point to the first character that breaks the JSON grammar, counted from 1. Chrome and Firefox usually give that position in their error message. When a browser gives none, the tool finds the position itself.
Does the formatter change my numbers or my strings?
No. Numbers and strings are written exactly as you typed them, so a long ID such as 12345678901234567890 keeps every digit. Only the spaces and line breaks around them change.
Is my JSON sent to a server?
No. The check and the formatting run in your browser. Nothing you paste is sent to our server or stored there.
Why is a comma after the last item an error?
JSON does not allow a comma after the last item of an object or an array, although many programming languages do. Remove the comma that comes just before the closing bracket or brace.
Can the tool fix invalid JSON for me?
No. It reports the first problem and leaves your text unchanged, because a repair could guess the wrong meaning. Correct the text at the position shown, then check it again.
Sources
Figures and text last checked on Tuesday, November 10, 2026.