JSON Formatter & Validator

Quick answer: Paste your JSON into the box below, then press Format to pretty-print it, Minify to shrink it to one line, or Validate to check it — the status line reports the exact error plus its line and column. Everything runs 100% locally in your browser: no data leaves this page, nothing is uploaded or stored.

This free JSON formatter and validator cleans up and checks JSON documents instantly. It reports character count, the top-level type, and key count or array length for valid JSON, and points you to the exact spot when parsing fails.

Your JSON

Output


        

How to use this tool

Paste your JSON into the text box (a sample is pre-filled so you can try it immediately). Press Format to pretty-print with 2-space indentation, Minify to compress it to a single line, or Validate to check correctness without changing the text. Copy copies the output, Clear empties the input. Typing in the box re-validates live, and the stats table updates with every change.

How this is calculated

Method: validation and formatting both run through the browser's built-in JSON parser. Format = parse, then re-emit with 2-space indentation; Minify = parse, then re-emit with no extra whitespace; Validate = parse and report success or the parser's error. When parsing fails, the error location is recovered best-effort from the engine's message — Chromium reports “at position N”, Firefox reports “line X column Y” — and converted to a line/column pair; treat it as a guide, not a guarantee.

Input definitions: the input is raw text expected to be strict standard JSON (double-quoted strings, no comments, no trailing commas). Assumptions: duplicate object keys keep the last value, as the standard parser does; number precision follows JavaScript double-precision floats.

Worked example

The pre-filled sample {"name":"CalcNest","tools":500,"live":true} formats to a 5-line pretty-printed object (opening brace, three key-value lines, closing brace) and minifies back to the identical 43-character string. Validation reports: valid JSON, top-level type object, 3 keys, 43 characters.

Reference data

JSON data types (ECMA-404 / RFC 8259, 2017)
TypeExample
Object{"a": 1}
Array[1, 2, 3]
String"hello"
Number42, -1.5, 1.2e3
Booleantrue, false
Nullnull

JSON strings must use double quotes; single quotes, comments, and trailing commas are not part of the standard.

Source: JSON — ECMA-404 / RFC 8259 (2017).

Method & sources

This tool is a thin wrapper around the browser's native JSON parser, which implements the ECMA-404 grammar: strict double-quoted strings, comma-separated members and elements with no trailing commas, and no comments. Error positions are derived from the parser's own error messages as described above.

  • ECMA-404, 2nd edition (2017) — the JSON data interchange syntax
  • RFC 8259 (2017) — the JSON text interchange format

No external data, estimates, or network calls are used anywhere on this page.

Frequently asked questions

What are the most common JSON errors?

Trailing commas after the last item, single quotes instead of double quotes, unquoted object keys, JavaScript-style comments, and missing closing brackets or braces. The Validate button reports the exact error message plus the line and column where parsing failed.

What is the difference between JSON and JSON5?

JSON5 is a superset of JSON that permits comments, trailing commas, single-quoted strings, and unquoted keys, which is friendlier for hand-written config files. This tool validates strict standard JSON only, so JSON5-only syntax will be reported as an error.

Is there a limit on how large my JSON can be?

There is no built-in limit — parsing happens entirely in your own browser tab. Very large documents of many megabytes may make the tab sluggish while formatting, but nothing is ever uploaded to a server.

Related calculators