OnlineTextLab
Esc

JSON Formatter & Beautifier

Readable JSON from a minified blob, with every number and key exactly as it was written.

Indent

Formatted JSON

Formatted JSON appears here as you type. Errors show the exact line and column.

Runs on your device. Your files and text are not uploaded.

About JSON Formatter

An API response, a log line or a config dump often arrives as one long line. Paste it here and you get it back indented, with colors, as you type. If the text is broken, you get the line and column of the problem instead of a blank pane.

The difference from most formatters is what it refuses to change. Many pages run your text through JSON.parse and print the result again, which rounds long integers and quietly drops repeated keys. Debugging with a copy that has been altered is how people end up chasing the wrong bug, so this page keeps your values exactly as they came in.

How it works

The page has its own strict JSON reader, written so that each number is kept as the original text. 12345678901234567890 stays that value, and 1.50 keeps its trailing zero. Keys stay in their original order unless you ask for sorting, and a repeated key stays in the output, with a note saying what most languages would do with it.

Formatting then writes that tree back with the indent you chose. Sorting compares keys by character code at every level, so Zebra comes before apple, and array order never changes. Remove null properties only touches values inside objects. Nulls inside arrays stay, because taking one out would shift the position of everything after it.

How to use JSON Formatter

  1. Paste JSON into the JSON to format box, press Upload to open a file, or drop a file on the box. Try an example fills in a sample.
  2. Choose an Indent: 2 spaces, 4 spaces or Tab.
  3. Turn on Sort keys A to Z or Remove null properties if you need them.
  4. Press Copy, or Download to save formatted.json.

A long ID that survives

Input
{"id":7,"name":"Ada","tags":["a","b"],"order_id":12345678901234567890,"nick":null}
Output
{
  "id": 7,
  "name": "Ada",
  "tags": [
    "a",
    "b"
  ],
  "order_id": 12345678901234567890,
  "nick": null
}

The order_id is above 2^53 - 1, so a formatter built on JSON.parse would print a different number. Here it stays intact, and a warning explains that browser code reading this response would round it.

When it helps

  • Reading a minified API response that you copied from the network panel of your browser
  • Checking whether a backend really sends the long ID it claims to, digit for digit
  • Sorting the keys of two config files so a later comparison shows only real changes
  • Stripping null properties from a payload before pasting it into a bug report

Tips for a better result

  • To compare two responses, format both with Sort keys A to Z on and put them in the Diff Checker. Key order stops showing up as noise.
  • Take the warning about large numbers seriously if the data is headed for a browser. Sending long IDs as strings is the usual fix.
  • The indent and toggle choices are saved in the page address, so a bookmark brings back your settings. The JSON itself is never put there.

Good to know

  • It accepts strict JSON only. Comments, trailing commas and single quotes are reported as errors and are not repaired.
  • Uploaded files can be up to 5 MB. Pasted text has no fixed limit, but very large input depends on your device's memory.
  • Syntax coloring switches off when the output passes 400,000 characters, to keep the page responsive.
  • Nesting deeper than 2,000 levels is refused.

Questions people ask

Why does my number look different in other tools but not here?

JavaScript stores numbers as 64-bit floats, so integers above 9007199254740991 get rounded when a tool uses JSON.parse. This formatter keeps the digits as text, so what you pasted is what you see.

What happens to duplicate keys?

Both stay in the output, in the order they appeared, and a note points to the line. Most parsers keep only the last one, so the duplicate is usually a mistake worth fixing at the source.

Can it fix broken JSON for me?

No. It tells you where the problem is and how to fix it, but it does not guess. A silent repair could change your data without you noticing.

Does sorting change the meaning of the data?

Not for objects, since JSON treats their keys as unordered. Arrays are ordered, so their items are left in place, and only the keys of objects inside them get sorted.

What to use next

Last reviewed . Read our editorial policy.