JSON Formatter

Validate, beautify, minify. Errors point at the exact line and column instead of just saying "unexpected token" — the position is computed here rather than taken from the engine (recent Chrome versions no longer report one for most errors).

—

—

What formatting changes

It drops extra whitespace and normalises the indent, which is what you want. But it also rewrites numbers: 1.0 becomes 1, 1e3 becomes 1000, -0 becomes 0. That is JSON.stringify behaviour, not a choice made here — if you are about to compare two documents byte for byte, keep the difference in mind.

Why the position is computed here

Engine error messages differ in wording and content, and recent V8 reports no position at all for the most common mistake (a stray comma). So this page runs its own scanner over the text first — it always knows which character it stopped on — and only then hands it to the browser to parse.

Questions

Does it support JSON5, comments or single quotes?

No, deliberately. JSON5 is a different language. If this page quietly accepted comments and single quotes, you would assume the data is acceptable to any JSON parser — and find out when it reaches a backend or a config file. This page takes standard JSON only, and names the rule you broke when it fails.

Is the content uploaded?

No. Parsing and formatting happen on this page; there are no network requests. Pastes containing logs or keys stay local.

Why does it say my JSON is valid when it has no keys?

Because [], {}, "abc" and 123 are all valid JSON — the top level does not have to be an object. This page answers "can this text be parsed", not "is this the structure you meant".

Mouse repair

QR codeWeChat
淘宝店铺二维码淘宝店铺

Mouse acting up? Get in touch.

Repair