Skip to main content
eyunzhu

JSON Formatter

Format · Minify · Check syntax

Validates as you type. Original numbers and key order are preserved.
Result

        

About this tool

Read API responses without losing numeric precision to formatting. Only whitespace between tokens changes, and duplicate keys remain visible with a warning.

How to use

Read API responses and configuration

Paste JSON or open or drop a UTF-8 file to update the result. Formatting makes API responses and nested configuration easier to review. Minifying removes unnecessary whitespace for request bodies or compact files; it does not create a ZIP archive.

Before and after formatting

This example uses two-space indentation. Every digit in id and the trailing zeros in amount stay unchanged.

{"id":9007199254740993,"amount":1.2300,"active":true}
{
  "id": 9007199254740993,
  "amount": 1.2300,
  "active": true
}

Why large integers need care

JavaScript Number cannot represent every integer above 9007199254740991 exactly. Tools that parse JSON into an object and then serialize it may turn 9007199254740993 into 9007199254740992. This formatter changes only whitespace between tokens, without converting numbers to Number. It also retains -0, 1e400, key order and string escapes. A downstream application still needs a parser that preserves the precision it requires.

Common validation errors

Keys and strings need double quotes, so {'name':'Ada'} is invalid. A trailing comma, as in {"a":1,}, is also invalid. Standard JSON does not allow // or /* … */ comments. The error message identifies the line and column; editing the input runs validation again. The tool does not guess how to repair ambiguous data.

Duplicate keys and checking your result

Both keys in {"a":1,"a":2} are retained with a warning. Other applications may keep only one value, so resolve duplicates before sharing the data. Copy and Download use the current result; review it after changing indentation or switching between formatted and compact output.

Limits and input storage

Input text and files are limited to 5 MiB of UTF-8 data, output to 20 MiB and nesting to 128 levels. Files must contain valid UTF-8. Processing takes place in the current browser. The tool neither uploads input nor writes it to local storage; copy or download anything you need before closing the page.

Common questions

Why are 9007199254740993 and 1.2300 preserved exactly?

The formatter never converts numbers through JavaScript Number before output. It only changes whitespace, retaining digits and trailing zeros. Downstream software still needs an appropriate parser to preserve precision.

How do I fix the reported line and column error?

Check that location and the preceding separator: JSON needs double-quoted keys and strings, with no comments or trailing commas. Fix the source; formatting and minifying do not automatically repair invalid JSON.

What should I do with the duplicate-key warning?

Both occurrences stay in the output, including keys that become equal after escape decoding. Decide which value belongs in the source; many downstream parsers silently retain only the last occurrence.

Does opening a JSON file send it to the server?

No. UTF-8 files are read locally, with a 5 MiB input limit. Choose indentation or minify, then copy or download the result. Invalid UTF-8, excessive nesting or oversized output must be corrected first.

Comments

0
to join the discussion.
No comments yet.
Reply thread

Follow the complete conversation chronologically; each reply identifies the specific message it answers.