Cookies for analytics and advertising
We use cookies for analytics and advertising, both sent to Google. Refusing changes nothing you can see.Read the privacy page
Paste JSON and read it. The document is parsed and printed again rather than re-indented as text, which is the difference between a formatter that understands a brace inside a string and one that mangles it. Nothing is uploaded — API responses are the single most common thing pasted into a tool like this, and they are rarely anybody public business.
Where it runs
Nothing is uploaded, because there is no file — it is worked out in this page.
No queue, no account
It answers as fast as your machine can, and it never asks who you are.
As often as you like
Nothing is counted and nothing is capped — answering again costs us nothing.
The cheap way to build a formatter is to walk the characters and add a newline after every brace and comma. It is fifty lines, it works on most input, and it fails on the one case that matters: a brace, a bracket or a comma inside a string value. A URL with a query string, a regular expression stored as a setting, a message containing a comma — any of those and the output is no longer valid JSON.
This one runs the document through a real parser and prints the result. The consequence is that anything it hands back is guaranteed to parse, and anything it refuses genuinely does not — there is no third state where a tool half-understood the input and produced something that looks right.
Parsing and reprinting is not free of consequences, and a tool that did not say so would be hiding them. Numbers are re-rendered in their shortest exact form, so `1.0` becomes `1` and `1e3` becomes `1000`. Duplicate keys collapse to the last one, because that is what every JSON parser does with them. Escaped characters that did not need escaping lose their backslash.
None of that changes what the document means to a parser, which is why it is acceptable. If you need the bytes preserved exactly — you are signing the document, or comparing a checksum — do not format it at all, because any formatter that reindents has already changed the bytes.
Two systems that serialise the same object often emit its keys in different orders, and the resulting diff is the size of the file — which makes reviewing a genuine one-field change impossible. Sorting both sides first collapses that to the change itself.
Arrays are deliberately left alone. An object is unordered by definition and reordering its keys changes nothing; an array is a sequence, and sorting one changes the data. Tools that sort both exist and they will silently reorder a list of steps, a list of coordinates or a list of migrations.
Two spaces is the convention for JSON in most ecosystems and is what `npm`, `composer` and most linters produce. Four turns up in Python-adjacent projects, since it matches the language. A tab is right where a file will be read in editors with different preferences, since the reader decides how wide it is.
The one place it is not a preference is a repository with a formatter already configured. Match it — a file reformatted with a different indent produces a diff touching every line, which costs a reviewer far more than the indent was ever worth.
A file with `//` in it is not JSON, and neither is one with a trailing comma. Both are JSON5 or JSONC, which are different languages that happen to look similar, and both are widely used in configuration files — `tsconfig.json` is JSONC, which surprises people who try to parse it with a strict parser.
This page rejects them rather than tidying them away, and that is the useful behaviour: it tells you that the thing you are holding will not parse where you are about to send it. A formatter that stripped comments silently would hand you a file that works and a mental model that does not.
JSON numbers become doubles, and a double holds integers exactly only up to about nine quadrillion. Past that, an identifier is rounded — a Snowflake id, an old Twitter status id, some database primary keys. `12345678901234567890` comes back as `12345678901234567000`, and nothing in the output says so.
This page notices and tells you, which is the most it can do. The fix is upstream: systems that emit identifiers past that limit send them as strings for exactly this reason, and if yours does not, formatting the document is not the step where you can repair it.
No. The parsing and printing both happen in this page, and the network panel will show nothing carrying your document. That matters here more than on most tools: what people paste into a JSON formatter is usually an API response from a system they work on, complete with whatever it contains.
Because JSON has no comments. A file with // or a trailing comma is JSON5 or JSONC — different languages that look similar, and what tsconfig.json actually is. Rejecting it tells you it will not parse in a strict parser, which is more useful than quietly stripping the comments and handing you a file that works here and fails there.
Not what the data means, but the bytes do change: numbers are re-rendered in their shortest exact form, duplicate keys collapse to the last one, and unnecessary escapes are dropped. That is what any parse-and-reprint does. If you need the bytes preserved exactly, for a signature or a checksum, do not reformat at all.
Only if you are about to compare two documents. Sorting both sides makes a diff show the actual change rather than every line, because two systems serialising the same object often order its keys differently. Array order is never touched, since an array is a sequence and sorting one changes the data.
Whatever your browser will hold in a text box. There is no server doing the work, so nothing is metered — but a document of several megabytes will make the tab think while it reformats on each keystroke, and at that size you are better served by a formatter in your editor.