Input

No input yet. Paste a document, type one, or press Sample.

Output

Formatted JSON appears here

Paste or type JSON in the panel on the left and it is formatted as you go.

Reading a Payload That Arrived as One Line

A payload comes back from an API as a single 4,000-character line, you need to know whether plan.dataGb is in there, and the terminal has wrapped the whole thing into a grey slab. Pretty-printing it is a two-second job that everybody solves twice a week, so the interesting question is not whether a formatter indents, every one of them does, but what it changes on the way through. This one is built so the answer is nothing except whitespace.

That matters more than it sounds, because the obvious implementation quietly corrupts data. Formatting normally means JSON.parse then JSON.stringify, and JavaScript numbers are IEEE-754 doubles that hold about 15 to 16 significant digits, so a 19-digit SIM identifier does not survive the trip. Paste {"iccid": 8901240544102066246} into a console, round-trip it, and what comes back is 8901240544102066000. No error, no warning; three digits are simply gone. This page keeps every number as the exact characters you typed, so a long integer comes back digit for digit (the example further down keeps all nineteen) and 1.50 keeps its trailing zero.

Everything else is the ordinary job, done carefully: two-space indentation unless you pick four spaces or a tab, one key per line, optional A to Z key sorting, a JSONPath box for the days you only want part of the document, and a parse failure reported with a line and a column you can click rather than a flat "invalid". The rules being applied are the ones in RFC 8259 (no trailing commas, no comments, no single quotes) and if you want the grammar on one page, json.org still has the clearest diagrams anyone has drawn for it.

Formatting a Document, Step by Step

  1. Paste or upload – Type or paste on the left, press "Paste" to pull in what is on your clipboard (the browser asks permission the first time), or press "Upload" for a .json or .txt file. An uploaded file lands in the input pane already indented with your current Indent setting, so you can tweak a value there before copying the result.
  2. Read the right panel – The output refreshes 300 ms after you pause, so a large paste is formatted once rather than on every keystroke. The strip under the input confirms "Valid JSON" with the top-level shape and the size; the strip under the output says how the result is laid out.
  3. Set the layout – Pick two spaces, four spaces or a tab from the Indent list. With "Sort keys A to Z" pressed, every object, nested ones too, lists its keys alphabetically, and arrays stay in their original order. The JSONPath box keeps only what an expression selects: with the sample loaded, $[*].validity returns ["25 days", "30 days"].
  4. If it says Invalid JSON, use the position – The input pane highlights the offending line in amber, and the strip beneath it names the line and column where the parser stopped. Click that strip, or "Jump to it" in the right panel, and your caret lands exactly there. The character that broke the document is usually at that spot or just before it, a missing comma being the classic case.
  5. Copy or download – "Copy" puts the formatted text on your clipboard; "Download" saves it as a .json file. Both read the output pane, so what you get is what you can see, sort order and filter included.
  6. Minify to go back the other way – The "Minify" button collapses the current output onto one line with the same sort and filter applied, and every number keeps its exact spelling, so a document can go format → minify → format and the digits still match.
  7. Give it the whole window – "Full screen" hides the page header and stretches the settings bar and both panes over the browser window, which helps with a long document. Esc, or the same button, brings the page back.

Pro Tip: If the document is an array of similar records, formatting only makes it taller. Send it to JSON to Table instead and read it as rows and columns: indentation is the wrong tool for repetition.

Example

A subscriber record as it arrives from an HSS lookup: one line, 112 bytes, unreadable. On the right is exactly what this page returns for it: 9 lines, 144 bytes. Look at the iccid. It still ends in 246. A plain JSON.parse → JSON.stringify round trip writes 8901240544102066000 on that line instead, which is the failure this page is built to avoid.

Minified → Pretty-printed Format
subscriber.jsonJSON · 1 line · 112 B
{"msisdn":"447700900142","iccid":8901240544102066246,"plan":{"name":"Unlimited 5G","dataGb":100},"roaming":true}
subscriber.jsonJSON · 9 lines · 144 B
{
  "msisdn": "447700900142",
  "iccid": 8901240544102066246,
  "plan": {
    "name": "Unlimited 5G",
    "dataGb": 100
  },
  "roaming": true
}

Common Use Cases

Debugging an API response

The endpoint returns minified JSON and you are looking for one field. Formatted, the answer is a glance: objects open and close where you expect, an unexpected null stands out on its own line, and a value that should be a number but arrived as "100" is visible because of the quotes. It is also where you notice the field you were promised is simply absent, which is the bug about half the time.

Checking a config before it ships

A settings.json edited by hand on a server is one missing comma away from a service that will not start. Paste it here first: a syntax error stops the formatting and the strip under the editor names the line and column, so you find the comma before the deploy does. Format the old and the new file the same way and a side-by-side text compare shows exactly which keys changed.

Checking what a system actually stored

Someone reports that an identifier came back wrong from an integration, and the first job is finding which hop broke it. Format the payload at each stage and compare the digits by eye: this page will not be the hop that lost them, which makes it a usable reference point. If the answer turns out to be a spreadsheet in the middle of the chain, that is a different and much older problem; MDN's note on how JavaScript encodes numbers explains why 15 digits is the boundary everywhere it shows up.

Frequently Asked Questions

Does my JSON leave the browser?

No. Parsing and formatting are done by code running in this tab, so a document you paste never crosses the network. You can confirm it the direct way: load the page, disconnect, and keep formatting. Nothing here is stored or logged either: reload and the pane is empty again. Sorting and the JSONPath filter run in the same tab, and "Paste" only reads your clipboard at the moment you press it.

Will formatting change any of my values?

No. Strings come back byte-identical, and every number is written exactly as you typed it: 8901240544102066246 stays 8901240544102066246 rather than rounding to …066000, 1.50 keeps its zero and 1e5 stays 1e5. Number literals are read straight from your source text instead of being turned into JavaScript numbers, so there is nothing to round. Two things can still move, and the next answer covers both.

So what does change, exactly?

Whitespace, obviously, plus two less obvious things. First, duplicate keys collapse to the last value: {"a":1,"a":2} formats to a single "a": 2, sitting where the first "a" was, because that is what JSON.parse does too, and it does it without a warning. Second, key order only changes if you ask for it. With "Sort keys A to Z" off, {"20":…,"3":…,"tac":…} comes back in exactly that order, even though a plain JavaScript object would quietly hoist "3" to the front. With sorting on, keys are ordered by character code, so "20" still comes before "3" and capital letters sort ahead of lowercase ones.

What happens if my JSON has errors?

Three things happen together. The line that broke is highlighted in the input pane, the strip under it reads something like Ln 18, Col 26: Trailing comma. JSON does not allow a comma before } or ]. (that is the sample with a comma typed after "30 days"), and the right panel shows "Invalid JSON" with the line and column as chips plus a link that moves your caret there. Missing comma, unclosed bracket, a trailing comma copied out of JavaScript, and smart quotes pasted from a document are the four you will actually hit. If the answer is not obvious from the position, Stack Overflow's JSON tag has the odd ones, and the JSON Fixer will attempt a repair on a document you did not write yourself.

How large a file can it handle?

There is no size limit in the code, and no chunking either: the whole document is parsed and re-serialised on every change, so cost scales with the file, not with what you are looking at. A few hundred kilobytes is comfortable. A file of several megabytes will make the tab pause on each edit, and at that point you are better off slicing the part you need out with jq and formatting that.

Can I sort the keys or pull out just one field?

Both, from the bar above the editors. "Sort keys A to Z" works at every depth, so with the sample loaded each plan now opens with "data" and ends with "validity", while the two plans keep their places because arrays are never reordered. The JSONPath box takes an expression rooted at $: $[1].data gives ["15GB"], and $[?(@.minutes == 'Unlimited')].planId gives [1002]. Results always arrive wrapped in an array, long numbers intact, and a path that selects nothing shows [] with a note underneath. The box speaks the classic JSONPath dialect; RFC 9535, published in 2024, standardised a version that reads paths this simple the same way.

What's the difference between beautify and minify?

Direction only. Beautify adds the indentation and newlines; minify strips them back out. Neither touches a value, so the round trip is safe both ways. Minify on this page keeps whatever sort order and JSONPath filter you have set; the JSON Minifier is the page to use when all you want is the whitespace gone.

Related Tools