Công Cụ Nhanh

JSON formatter and validator

Output style
Indent

You can also drop a .json file onto the input.

Processed in your browser. Your files and data are never uploaded to a server.

Quick answer

Paste JSON above: it is validated against RFC 8259 as you type, errors show the exact line and column, and you can beautify (2 / 4 spaces or tabs) or minify it. Big numbers such as 12345678901234567890 are kept exactly as written.

What is a JSON formatter?

This JSON formatter beautifies, minifies and validates JSON from APIs, config files and logs. Unlike tools that run data through JSON.parse and print it back, it parses the text itself, so every number, string and escape stays exactly as written; only whitespace and, if you choose, key order change. Parsing runs in a Web Worker in your browser and your data goes nowhere.

Illustration of messy data cards being tidied into a neat, aligned stack

How to format and validate JSON

  1. 1

    Paste JSON into “JSON input”, click “Open .json file” or drag a file onto the box; “Sample data” loads an example.

  2. 2

    Read the status below: “Valid JSON” with stats, or an error with line, column and a snippet; “Go to error” jumps to the problem.

  3. 3

    Choose “Beautify” with 2 spaces, 4 spaces or tabs, or “Minify”; turn on “Sort keys A→Z” to compare documents.

  4. 4

    Click “Copy” or “Download .json” to take the full result.

Common JSON syntax errors and the fix

WrongWhyRight
{"a": 1,}Comma after the last item{"a": 1}
{'a': 'x'}Single quotes{"a": "x"}
{a: 1}Unquoted key{"a": 1}
{"a": 1} // noteJSON has no comments{"a": 1}
{"a": NaN, "b": undefined}NaN, Infinity and undefined are not JSON values{"a": null, "b": null}
{"code": 007}No leading zeros in numbers{"code": "007"} or {"code": 7}
{"x": .5, "y": +1}Missing leading digit, plus sign{"x": 0.5, "y": 1}
{"a": 1}{"b": 2}Two JSON documents pasted together[{"a": 1}, {"b": 2}]

How JSON differs from a JavaScript object

AspectJSON (RFC 8259)JavaScript object
KeysDouble quotes requiredUnquoted, single or double quotes
StringsDouble quotes onlySingle, double or backticks
Trailing commaNot allowedAllowed
CommentsNot allowedAllowed
ValuesString, number, true, false, null, array, objectAlso undefined, NaN, functions, Date…
Big numbersUnlimited in the textLose precision above 2^53 (9,007,199,254,740,991)

Real-world examples

Reading a one-line API response

Paste a response from Postman or your browser's Network tab and beautify with 2 spaces to see the nesting and find the field you need.

A config file that will not load

Your app fails to read config.json? Paste it in: a message like “Trailing comma before “}”” with the line and column tells you exactly what to fix.

Order IDs that are huge numbers

{"transaction_id": 12345678901234567890} is kept intact when formatting, with a warning that it exceeds 2^53 so you can consider storing it as a string.

Comparing two configs

Sort keys A→Z in both documents, then diff them: with keys in the same order, only real differences remain.

Common issues

“Extra data after the JSON ended”.
Usually two JSON documents pasted together, or a log line with text after the JSON. Wrap them in an array [ … ] or delete the extra text.
A large file does not appear in the input box.
Input over 1 MB is replaced by a summary card so the page stays responsive; validation and formatting still use the full data. Click “Edit anyway” if you must edit by hand.
The result box looks cut off.
Very long results only show their beginning to keep the browser fast. “Copy” and “Download .json” always take everything.
A special whitespace character is reported.
Text pasted from Word, chat apps or PDFs can contain non-breaking spaces. Delete and retype a normal space at the reported position.
A file will not open.
Files up to 10 MB in UTF-8 are supported. Larger files or other encodings (UTF-16) need converting first.
“JSON is nested too deeply”.
Nesting is capped at 1,000 levels to avoid freezing the browser. Real data is rarely that deep; check for a loop in whatever exported it.

Glossary

RFC 8259
The official standard for JSON syntax that the validator follows.
Beautify
Adding line breaks and indentation so JSON is easy to read, without changing the data.
Minify
Removing all unnecessary whitespace so JSON is as small as possible.
Escape
How special characters are written in a string, such as \n (newline), \" (quote), \u00e9 (é).
BOM
An invisible marker at the start of some UTF-8 files created on Windows; it is skipped and reported.
2^53
The largest integer JavaScript stores exactly (9,007,199,254,740,991); larger values may be rounded.

Frequently asked questions

Is my JSON sent to a server?

No. Parsing and formatting run entirely in your browser, so it is safe to paste tokens, internal configs or customer data.

Why are comments and trailing commas rejected?

Standard JSON does not allow them. Some editors accept extended formats (JSONC, JSON5), but regular JSON APIs and libraries reject such data.

Does sorting keys change my data?

No values change. Key order in an object carries no meaning; array order is preserved.

Are duplicate keys reported?

Yes, as a warning with the line number. The JSON is syntactically valid, but many systems keep only the last value. Identical warnings are grouped with a repeat count.

How are line and column counted?

Both start at 1, and columns count characters (an emoji is one character). The snippet's ^ marks the exact spot.

Does minifying keep accented text intact?

Yes. Strings and escapes stay exactly as written, whether you typed “é” directly or as “\u00e9”.

Ratings and comments

Loading…