Β· tutorials Β· 6 min read

How to Format JSON Online (Free, No Sign-Up)

Format JSON online in three steps, fix trailing commas and single quotes, and catch big integers other tools silently round β€” free, in your browser.

JSON is everywhere: API responses, config files, database exports, log lines. And it usually arrives as a single unreadable line. Formatting it takes seconds β€” if you know how, and if your formatter tells you what is wrong instead of just failing. This guide shows how to format JSON online in three steps, how to fix the errors that stop JSON from parsing, and two traps most formatters never warn you about: big integers that silently change value, and duplicate keys that silently drop data.

How to format JSON online in 3 steps

  1. Paste your JSON into the input box. It is checked as you type, so you see the result immediately. Very large pastes β€” over 100,000 characters β€” wait for the Format button instead, so the page never freezes.
  2. Pick an indent, or hit Minify. Choose 2 spaces, 4 spaces or a tab for readable output, or Minify for a single line. Turn on β€œSort keys” if you want object keys in alphabetical order.
  3. Copy the result or download it as a .json file. If the result is very long, only the first part is shown on screen β€” Copy and Download always give you the full text.

That is the whole workflow. Everything runs in your browser: what you paste never leaves your computer, there is no account and no sign-up. Once the page has loaded, it keeps working even if you disconnect from the internet.

Fixing the errors that stop your JSON from parsing

Most β€œinvalid JSON” errors come from three mistakes. A good formatter does not just say β€œinvalid” β€” it shows you the exact line and column, the offending line itself, and a pointer to the character to fix.

Trailing commas. JSON does not allow a comma after the last item in an object or array. This fails:

{"a": 1,}

The fix is to remove the comma before } or ]. The formatter reports Trailing comma with the exact position β€” line 1, column 9, pointing at the } β€” so you do not have to hunt through a long file. The same applies to arrays: [1, 2,] fails at line 1, column 7. On multi-line input the pointer still lands on the right line and column.

Single quotes. JSON strings must use double quotes. This fails:

{'a': 1}

Replace the single quotes with double quotes: {"a": 1}. The formatter reports Single quotes are not valid JSON and suggests the fix.

Comments. JSON has no comments, even though JavaScript does. Both of these fail:

{"a": 1 /* x */}
{"a": 1} // done

Remove the comment and the JSON parses. The formatter reports Comments are not valid JSON.

Other things the formatter catches: an empty input, a leading zero such as 0123, a truncated literal such as tru, and a lone high surrogate in a string. Each error comes with the line, the column, the line of text, and a ^ pointer β€” the same information you would want from a compiler.

Big integers: the number that changes behind your back

This is the trap most formatters never warn you about. JavaScript numbers are 64-bit floats, so integers beyond 9,007,199,254,740,991 (2^53 βˆ’ 1) cannot be represented exactly. When a formatter runs your JSON through JSON.parse, a big integer gets rounded β€” silently.

Take this ID:

{"id": 9007199254740993}

Run it through a formatter built on JSON.parse and the ID comes out as 9007199254740992. No error, no warning β€” a different number. Snowflake IDs, 64-bit database keys and Discord-style IDs are the usual victims, and the damage only shows up later, when a lookup fails or two records collide.

Our formatter does not round. It keeps big integers exactly as written and shows a warning next to them, so you can decide what to do. The boundary is exact: 9,007,199,254,740,991 (2^53 βˆ’ 1) passes with no warning, 2^53 warns, and negative big integers warn too. Ordinary decimals such as 1.5 and exponents such as 1e10 do not trigger false warnings.

Duplicate keys are the second silent trap. This is legal JSON:

{"a": 1, "a": 2}

But only the last value survives β€” the output is {"a": 2}. JSON.parse drops the first value without a word, and most formatters do the same. It is almost always a copy-paste mistake, and it is easy to miss in a long object.

Our formatter warns you and points at the second key (line 1, column 10 in the example above), while keeping the last value, exactly as the JSON standard specifies. With three copies β€” {"a":1,"b":2,"a":3,"a":4} β€” you get two warnings and the output {"a":4,"b":2}.

Minify and sort keys: when to use them

Minify removes all unnecessary whitespace so the JSON takes as little space as possible. Use it when you paste JSON into a request body, a config file, or anywhere size matters. {"b":1,"a":[1,2]} stays exactly that β€” one line, same data.

Sort keys orders object keys alphabetically, including nested objects: {"b":1,"a":2,"c":{"z":1,"y":2}} becomes {"a":2,"b":1,"c":{"y":2,"z":1}}. Use it when you compare two JSON files, when you want deterministic output for tests or snapshots, or when you want a messy config file to read in a predictable order. With sorting off, the original key order is kept.

Format is the default: line breaks and indentation so the structure is easy to read. Use it when you are debugging, reviewing an API response, or reading a config file.

FAQ

Is my JSON uploaded anywhere?

No. The formatter is pure JavaScript running in your browser. Nothing is sent to a server, there is no account, and nothing you paste is tracked.

Why does my formatter change my big numbers?

Because it parses with JSON.parse, which stores numbers as 64-bit floats. Any integer above 2^53 βˆ’ 1 gets rounded to the nearest representable float. Use a formatter that keeps big integers as written and warns you about them.

What is the difference between Format and Minify?

Format adds line breaks and indentation so the structure is easy to read. Minify removes all unnecessary whitespace so the JSON takes as little space as possible β€” useful for request bodies and config files.

Try it now

Paste your JSON into the JSON Formatter and see the result in seconds β€” formatted, minified, or validated, with warnings for the two traps other tools stay silent about.

Share:
Back to Blog

Related Posts

View All Posts Β»