JSON Formatter
Format, validate and minify JSON, with errors pointed out line by line.
Runs entirely in your browser. Nothing you paste is sent anywhere.
JSON Formatter at a glance
- Price
- Free
- Data sent anywhere
- No, it runs in your browser
- Sign-up
- Not needed
- Indentation
- 2 spaces, 4 spaces or tabs
- Error location
- Line and column
- Fixes
- Trailing commas, quotes, comments, unquoted keys
Paste JSON to format it with clean indentation, minify it to one line, or check that it is valid. Errors are shown with the exact line and column and a pointer to the problem, and common mistakes like trailing commas, single quotes, comments and unquoted keys can be fixed in one click. Sort keys alphabetically, then copy or download the result. It runs entirely in your browser, so your data is never sent anywhere.
Why JSON breaks, and how to spot it fast
JSON is strict. Almost every error comes from one of a handful of mistakes, usually made when JSON is typed by hand or copied from JavaScript or Python code:
- A trailing comma after the last item in a list or object,
like
[1, 2, 3,]. JavaScript allows it; JSON does not. - Single quotes around strings or keys. JSON only accepts double quotes.
- Keys without quotes, like
{name: "Ana"}. Every key must be a string in double quotes. - Comments. JSON has no comments at all, which surprises people coming from configuration files.
- A missing comma between two items, usually at the end of a line. The error is reported at the start of the next item, so look one line up.
- Python values such as
True,FalseandNoneinstead oftrue,falseandnull.
When JSON is invalid, the tool shows where reading stopped, with a pointer under the character. The actual mistake is at that point or just before it. Fix common mistakes repairs every problem above except a missing comma, and tells you exactly what it changed.
Long numbers lose digits
JSON itself allows numbers of any length, but almost every program that reads
it, including browsers, stores numbers with about 15 to 17 significant digits.
A 20-digit order ID is silently rounded, so 12345678901234567890
comes back as 12345678901234567000. The formatter warns you when this
happens. The reliable fix is to send such IDs as strings.
Safe for private data
Many online formatters send what you paste to their server. That is a real risk when the JSON is an API response containing access tokens, customer details or order data. This formatter does everything in your browser, and nothing you paste leaves your device.
What it does
- Format with 2 spaces, 4 spaces or tabs, or minify to one line
- Points to the exact line and column of an error
- Fixes common mistakes: trailing commas, single quotes, comments, unquoted keys and Python-style True, False and None
- Sort keys alphabetically at every level
- Warns when very long numbers would lose precision
- Copy or download as a .json file
- Your data never leaves your device, so it is safe for API keys and customer data
Questions
Is my JSON sent to a server?
No. Formatting and validation happen in your browser on your own device. Nothing you paste is sent to us or stored, so it is safe to use with private data.
How do I find the error in my JSON?
Press Format. If the JSON is not valid, the tool shows the line and column where reading stopped, with a pointer under the problem character, and moves the cursor there. The mistake is at that point or just before it, such as a missing comma or quote.
What does Fix common mistakes change?
It removes comments and trailing commas, changes single-quoted strings to double-quoted, adds quotes around unquoted keys, and turns Python's True, False and None into true, false and null. It tells you what it changed, and you can undo it.
What is the difference between formatting and minifying?
Formatting adds line breaks and indentation so people can read it. Minifying removes all unnecessary spaces and line breaks to make the file as small as possible for sending or storing. Both contain exactly the same data.
Why did a long number change?
Browsers, and most programming languages, store numbers with about 15 to 17 significant digits. Longer numbers, like some IDs, get rounded. The tool warns you when this happens. Keep such IDs as strings in quotes.
Does sorting keys change the data?
No. JSON objects have no meaningful key order, so sorting only makes them easier to read and compare. Arrays keep their order.
Is there a size limit?
No fixed limit. Files of several megabytes work well; very large files depend on your device's memory.