Skip to content
HNarzędzia
en
Categories

JSON formatter and validator online - beautify and minify

Paste JSON to beautify or minify it instantly. If it is invalid, you get the exact line and column, a code excerpt with a caret and a plain-language explanation.

  • Free
  • No sign-up
  • Private
  • Runs locally

How to do it?

  1. 1.

    Paste your JSON

    Paste JSON into the left box, open a .json file or insert the sample.

  2. 2.

    Choose a mode

    Beautify adds indentation (2 spaces, 4 spaces or tab); Minify strips all unnecessary whitespace.

  3. 3.

    Copy or download

    Copy the result or download it as a .json file.

Common JSON errors

  • Trailing comma - {"a": 1,} is invalid.
  • Single quotes - keys and strings must use double quotes.
  • Unquoted keys - {a: 1} is a JavaScript object literal, not JSON.
  • Comments - JSON (RFC 8259) has no comments; that is JSON5/JSONC.
  • Raw newlines in strings - use \n.

Beautify or minify?

Beautify (pretty print) adds indentation and line breaks so the structure is easy to read, review in Git and debug when inspecting an API response. Minify removes spaces, tabs and newlines outside strings, typically cutting the size by 20-40% and speeding up transfer. Example: { "a": [ 1, 2 ] } minified becomes {"a":[1,2]}.

Sort keys orders object keys alphabetically at every level (arrays keep their order). Run it on two versions of the same document and the differences line up, which makes comparing them much easier.

JSON data types

  • object - {"key": value}, keys always in double quotes,
  • array - [1, 2, 3],
  • string - "London" (escapes: \" \\ \n \t \uXXXX),
  • number - 42, -3.14, 1e6 (no leading zeros, no NaN or Infinity),
  • booleans true/false and null.

Anything else - undefined, dates, functions, comments - is not JSON. Dates are usually sent as ISO 8601 strings such as "2026-10-11T09:30:00Z".

How to read the error message

The validator reports the line, column and character position where parsing failed and shows a code excerpt with a caret. The reported spot is often after the actual mistake: a missing comma between items on line 12 is reported at the start of line 13, and an unclosed quote is only detected at the end of the document as “unexpected end of data”. Check the marked character first, then the token right before it.

The validator follows RFC 8259 / ECMA-404. Files with comments and trailing commas, such as VS Code settings, are JSON5 or JSONC and will be reported as invalid by JSON.parse.

Frequently asked questions

Is my JSON sent to a server?

+
No. Formatting and validation run entirely in your browser.

Why is my JSON invalid when it works in JavaScript?

+
JavaScript object literals allow unquoted keys, single quotes, comments and trailing commas. Strict JSON does not.

Can large numbers lose precision?

+
Yes. Integers above 2^53 − 1 cannot be represented exactly by JavaScript numbers. Send long IDs as strings.

What does “sort keys” do?

+
It orders object keys alphabetically at every level while keeping array order, which makes diffs easier.

What is the difference between JSON and JSON5?

+
JSON5 is a superset that allows comments, trailing commas, single quotes and unquoted keys. Standard JSON parsers, including JSON.parse, reject those.

Can I open a .json file?

+
Yes. Use “Open file” to load it from your device - it is read locally and never uploaded. You can download the formatted result as a .json file.

Updated: