How to format JSON and find the error
A payment provider or shipping company sent you a reply as JSON on one long line, and you want to know what it says. Or you added a product to a settings file and your store stopped reading it. Formatting makes the data readable, and tells you exactly where the error is.
What is JSON?
A text format for exchanging data between systems, used by most APIs and store platforms. Its rules are strict: keys in double quotes, no comma after the last item, no comments. One small mistake makes the whole file invalid.
The following minified text is 26 bytes:
Formatted with 2 spaces it becomes nine tidy lines and 57 bytes. Its depth is 2, and it has 3 keys.
{"b":[1,2],"a":{"c":null}}
Where is the error?
A 3-line text made of an opening brace, then "a": 1 with a comma, then a closing brace, is invalid because of the trailing comma. The tool places the error at line 3, column 1: the closing brace where a key name was expected. The tool never fixes errors on its own; it shows you where they are so you decide.
How to do it
- Open the JSON formatter and validator and paste your JSON, or open a file.
- Choose formatting with 2 or 4 spaces or a tab, or minify it onto one line.
- If there is an error, read the message, line and column, and correct the text.
- Copy or download the result.
What to know
- The limit is 5 MB. A file of that size was formatted and displayed in about 3 seconds.
- Integers above 9007199254740991 lose precision in JavaScript, and the tool warns you. Store them as strings if they are IDs.
- If a key repeats in the same object, only the last value survives, and the tool lists the repeated keys.
- The error message comes from your browser in English, and differs slightly between browsers.
If your data is a table you want to open in Excel, convert it with the CSV and JSON converter. If you find a Base64-encoded value inside the JSON, decode it with the Base64 encoder/decoder tool.
Common questions
Does the tool repair broken JSON?
No. It only shows where the error is, because an automatic repair could change your data without you noticing.
Is the JSON I paste safe?
Yes, it is read inside your browser and not sent to any server. Even so, do not paste secret keys anywhere you do not need to.
Why does a line with Arabic and numbers look reversed?
That is how browsers display bidirectional text. The data itself is in the correct order when you copy or download it.
