Skip to content
Shrake DevTools
  • JSON FormatterData & Format

JSON Formatter

Format, validate and minify JSON with syntax highlighting and precise error locations.

Input

Output

Runs locally in your browser. Your input is not uploaded.

How to use the JSON Formatter

  1. Paste JSON into the input editor, or click Sample to try it.
  2. The formatted result appears instantly. Choose Format to pretty-print with 2 spaces, 4 spaces or tabs, or Minify to remove all whitespace.
  3. If the JSON is invalid, you'll see what's wrong, where (line and column), and how to fix it.
  4. Copy the result or Download it as a .json file.

What makes this formatter different

  • Private. Formatting happens entirely in your browser. Your JSON is never uploaded, so it's safe for API responses, config files and tokens.
  • Lossless. Numbers and strings are kept exactly as written. Many formatters parse JSON into JavaScript first, which silently rounds large IDs like 12345678901234567890 to 12345678901234567000 and rewrites 19.90 as 19.9. This one doesn't.
  • Helpful errors. Instead of a generic "Unexpected token", you get the exact position and a plain-English fix.
  • Fast on large files. A 1 MB document formats in well under a second.

Example

Input:

{"id":1,"name":"Asha","roles":["admin","editor"],"active":true}

Formatted with 2 spaces:

{
  "id": 1,
  "name": "Asha",
  "roles": [
    "admin",
    "editor"
  ],
  "active": true
}

Common JSON errors it explains

  • Trailing commas, like {"a": 1,}. JSON doesn't allow a comma after the last item.
  • Single quotes, like {'a': 1}. Strings and keys must use double quotes.
  • Unquoted keys, like {a: 1}. Valid in JavaScript, but not in JSON.
  • Comments (// and /* */). These aren't part of JSON.
  • Non-JSON values like undefined, NaN, Python's True and None, or hex numbers like 0x1F.
  • Missing commas, colons, brackets or braces, and unterminated strings.

Frequently asked questions

Is my JSON uploaded anywhere?

No. All processing runs in your browser with JavaScript. Nothing you paste is sent to a server or stored.

Does it validate the JSON too?

Yes. Every change is checked against the strict JSON standard (RFC 8259). You'll see "Valid JSON" when it's correct, or the first error with its line and column when it isn't.

Will formatting change my data?

No. Only whitespace between tokens changes. Keys, values, number formats, key order and string escapes like é stay exactly as they were.

Can it format JSON with comments (JSONC)?

Not yet. Comments aren't valid JSON, so the formatter points them out so you can remove them. That makes the output safe for any strict JSON parser.

What's the difference between Format and Minify?

Format adds line breaks and indentation so JSON is easy to read. Minify removes all unnecessary whitespace to make the file as small as possible, which is useful for APIs and storage. The status line shows the size before and after.