Skip to content
Webmaster Tools
JSON & dataJSON Formatter

JSON Formatter & Validator

Format, minify and validate.

Paste or type JSON
Output

        
Valid JSON Invalid JSON Runs in your browser

About the JSON Formatter

This tool validates JSON against the standard grammar (RFC 8259) and reformats it. Format mode pretty-prints with 2 spaces, 4 spaces or tabs; Minify mode strips all insignificant whitespace. You can also sort keys alphabetically at every level to make payloads easier to compare. The output is syntax-highlighted with line numbers, and the status bar shows the size before and after, the line count, and how many keys, values and nesting levels the document has.

Parsing happens in your browser with the built-in JSON.parse, so you can paste API responses that contain tokens or customer data without sending them anywhere.

How to use it

  1. Paste JSON into the input pane, or click Load sample.
  2. Pick Format or Minify, an indent size, and whether to sort keys.
  3. If the input is invalid, read the error, which points to the line and column where parsing stopped.
  4. Copy the output or download it as formatted.json.

Examples

Common questions

Why is my JSON invalid?

The usual causes are trailing commas, single-quoted strings, unquoted keys, comments, and values like NaN or undefined. All of these are accepted by JavaScript but not by the JSON standard.

What happens to duplicate keys?

RFC 8259 says names should be unique but doesn't forbid duplicates. JSON.parse keeps the last value, so the formatted output contains only one copy of the key.

Why did a large number change?

Numbers are parsed as 64-bit floats, so integers above 2^53 (such as some database IDs) lose precision when reformatted. Send such IDs as strings if they must survive round trips.