Skip to content
ToolMug

JSON Formatter & Validator

Paste JSON to pretty-print it, minify it, or find exactly where it is broken — with the line, column and a plain-language reason. Large numbers such as 64-bit IDs are kept exactly as written, and your data stays in your browser.

Runs in your browser — nothing you enter is uploaded

Settings

Input

Output

How to use

  1. Paste or type your JSON in the left box. It is checked as you type.
  2. Choose the indentation — 2 spaces, 4 spaces, tabs, or Minify for a single line.
  3. Tick Sort keys to order object keys alphabetically, which makes two documents easier to compare.
  4. If there is an error, the message shows the line and column; otherwise copy or download the result.

Options explained

Indent
2 spaces is the most common style (npm, Prettier); 4 spaces matches Python's json.dumps(indent=4); Minify removes all whitespace for the smallest size.
Sort keys
Sorts object keys by their decoded value, at every level. Array order is never changed.
Big numbers
Numbers are kept as written. Many formatters parse JSON into JavaScript numbers, which silently turns 12345678901234567890 into 12345678901234567000.

Common JSON errors and how to fix them

Message Typical cause
Unexpected character ' Single quotes instead of double quotes
Trailing comma A comma after the last item: [1, 2,]
Unexpected character / A // comment copied from JavaScript
Document ends too early Missing } or ], often from a truncated copy
Control characters must be escaped A real tab or line break inside a string — use \t or \n
Unexpected content after the end Two JSON documents pasted together, or text after the closing bracket

Example

Input:

{"id":9007199254740993,"name":"Ada","tags":["math","code"]}

Formatted with 2 spaces — note the ID is unchanged:

{
  "id": 9007199254740993,
  "name": "Ada",
  "tags": [
    "math",
    "code"
  ]
}

Frequently asked questions

Why does it say "trailing comma is not allowed"?

Standard JSON (RFC 8259) forbids a comma after the last item of an object or array, even though JavaScript allows it. Remove the comma before the closing } or ].

Can I use single quotes or comments in JSON?

No. JSON strings must use double quotes, and comments are not part of the format. Files like tsconfig.json accept them because their tools use a relaxed parser (JSONC).

Is my JSON sent to a server?

No. Parsing and formatting happen in your browser, so API responses, tokens and configuration files stay on your device.

Why do my large IDs change in other tools?

JavaScript stores numbers as 64-bit floating point, which is only exact up to 9,007,199,254,740,991. This tool never converts numbers, so IDs beyond that stay intact.

How large a file can it handle?

Documents of several megabytes format instantly on a laptop. For files of hundreds of megabytes, a command-line tool such as jq is a better fit.

Privacy

This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.

Related tools