Format, minify and validate JSON instantly — with precise error location.
JSON (JavaScript Object Notation) is a lightweight, human-readable, easy-to-parse data format. It has become the standard data format on the web — used for REST APIs, config files, and NoSQL databases.
This tool helps tidy up hard-to-read JSON strings (e.g. from API responses), minify for production, and locate syntax errors with exact line and column information.
JSON is strictly specified (RFC 8259). Common gotchas that cause parser errors:
JSON has been specified since December 2017 in RFC 8259 and in parallel in ECMA-404. The standard allows six value types — string, number, true/false, null, object, array — and mandates UTF-8 as the default encoding for data exchange between systems. Whitespace between tokens is irrelevant to machines but vital to humans: an API response like {"a":1,"b":[2,3,{"c":"d"}]} is hard to read, while the formatted version with two-space indentation makes structure, ownership and depth immediately visible.
Formatting (beautify) inserts line breaks and indentation without changing semantics. Common indentations are 2 or 4 spaces or tabs — most style guides (Airbnb, Google, Prettier default) prefer 2 spaces. Minify is the inverse: every non-significant whitespace is stripped, typically shrinking the file by 20–40%. This saves bandwidth on API responses and is mandatory for in-body payloads in Lambda Edge functions or Service Workers, where every byte matters.
Strictly per RFC 8259, comments are forbidden, single quotes are illegal and trailing commas are invalid. Browsers and Node.js (via JSON.parse) are unforgiving here. More tolerant variants include JSON5, HJSON or JSONC (the VSCode config flavor). Our formatter sticks to the standard; if you have JSONC or JSON5 input, run it through a matching parser first before validating here.
Five steps from a raw blob to cleanly structured JSON:
curl output, an API response, a .json file or a DevTools console dump.Format.Format for pretty-print, Minify for the compact variant or Validate for syntax-only checking. On errors the offending line and column are reported..har file. Tip: the URL parameter ?data= automatically shares the input JSON — handy for sending links to colleagues.These typical inputs and outputs occur every day:
{"a":1,"b":2} turns into multi-line {
"a": 1,
"b": 2
}.{"user":{"name":"Anna","roles":["editor","author"]}} becomes three structured levels — you immediately see that roles is an array nested under user.{"a":1,} the validator reports "Unexpected token } in JSON at position 7" — trailing commas are forbidden.{'a':1} is not valid JSON. JavaScript object literals look like this, JSON however requires double quotes — the error reads "Expected property name or '}'".Even a "simple" formatter has serious edge cases. First: number precision. JavaScript's JSON.parse turns numbers into IEEE-754 doubles. Values above 2^53 − 1 lose digits — 10765432109876543 can become 10765432109876544. If you process Snowflake or Twitter IDs, transmit them as strings. Second: strict mode mismatches. Trailing commas, comments, single quotes or unquoted keys are forbidden by RFC 8259 — browsers will not parse them. For such inputs use JSON5 or sanitize first. Third: Unicode escaping. JSON.stringify without a replacer writes non-ASCII through directly (UTF-8). When dealing with legacy systems you may need \uXXXX escaping — valid but not our tool's default. Fourth and security-critical: logging JSON with secrets. Pretty-printing makes bearer tokens and API keys readily visible in logs, screenshots or shared URLs. Mind the payload before copying or linking. Fifth: prototype pollution. JSON.parse itself is safe, but downstream Object.assign(config, parsed) can be attacked via __proto__ or constructor as keys to poison the global prototype — filter those keys or use Map instead.
{"a":1,} is illegal even though many editors would tolerate it. Drop the last comma or run a JSON5 parser. In the build, ESLint or Prettier should catch this automatically.// and /* */), trailing commas, single quotes, unquoted keys and hex numbers. It is more human-friendly for configs but not understood by JSON.parse. Babel, Webpack and ESLint use JSON5 for their config files."_comment": "…" ignored by consumers. JSONC has become the de-facto standard for config files.?data= URL parameter stays local — it lives in the URL only, never sent to the server.