LocalToolkit
HomeData Converters › JSON Formatter & Validator

JSON Formatter & Validator

Pretty-print, minify, and get a real line-and-column error when the JSON is malformed.

🔒 Runs in your browser. Nothing is uploaded — verify it in the network panel, or disconnect and try again.

Everything strict JSON forbids

JSON is defined by RFC 8259 and it is deliberately austere. Every one of the following is a syntax error, even though a JavaScript object literal would accept it:

The number precision trap

JSON numbers are IEEE 754 double-precision floats. That means every integer up to 2^53 (9,007,199,254,740,992) is exact, and beyond that values silently lose precision. A 19-digit database identifier or a snowflake ID round-trips to a different number, and nothing in the parser warns you. If your API carries large integers — Twitter/X IDs, Discord IDs, MongoDB ObjectIds in numeric form, financial amounts in minor units — send them as strings.

Duplicate keys and other silent surprises

Formatting versus minifying, and what actually reduces bytes

Pretty-printing adds indentation, newlines and spaces purely for human reading — it never changes the meaning. Minifying strips exactly those characters. The saving is typically 10 to 20 percent of an uncompressed payload, and close to zero if the response is gzip or Brotli compressed, because the compressor already removes redundant whitespace. Minify for readability in logs and for small JSON embedded in a URL; enable compression for transport.

For structured logs, prefer JSON Lines — one complete JSON value per line — over one giant array. A single malformed line then costs you one record instead of the whole file, and the format streams naturally.

How to use it

  1. Paste JSON, or drop a .json file.
  2. Choose an indent of two spaces, four spaces, or a tab.
  3. Read the validation result — a syntax error is reported with its line and column.
  4. Minify if you need the compact form for embedding or logging.

Worth knowing

  • Governing standard is RFC 8259, published December 2017.
  • Integers above 2^53 lose precision as IEEE 754 doubles.
  • Comments, trailing commas and single quotes are all invalid.
  • Duplicate keys are accepted by most parsers with last-one-wins behaviour.

Limitations

  • No JSON5, JSONC or JSON Lines parsing — strict RFC 8259 only.
  • Large documents are bounded by available tab memory.
  • Validation checks syntax, never a schema — use JSON Schema for structural rules.
  • Property order is not normalised, so this output is not a canonical form for signing.

Frequently asked questions

Why is my JSON invalid when it works in JavaScript?
Because a JavaScript object literal is more permissive than JSON: it allows unquoted keys, single quotes, trailing commas and comments. Strict JSON allows none of them.
Can JSON have comments?
No. If you need comments, JSON5 and JSONC add them, and YAML supports them natively — but strict JSON parsers will reject the file.
Why did my long ID change value?
Because it exceeded 2^53 and was stored as a double-precision float. Send large integers as strings to preserve them exactly.
Does minifying JSON make it smaller on the wire?
Barely, if the response is compressed. Gzip and Brotli already eliminate redundant whitespace, so the gain from minifying a compressed payload is usually under a percent.
Related tools
JSON MinifierJSON to CSV ConverterJSON to YAML ConverterJSON to XML ConverterCSV to JSON ConverterYAML to JSON Converter
Keep reading
How browser-only processing worksAll Data Converters toolsEvery tool on the site