JSON Formatter

Format JSON with two-space indentation, minify it, or check it for errors with line and column positions.

Mode

Paste or type JSON; invalid input is reported with a position when available.

How it works

Paste or type JSON into the input pane, choose Format or Minify, and select the action. The result appears in the output pane, ready to copy.

Everything runs in your browser: the JSON you paste is never sent to a server.

Formatting

Format re-prints the document with two-space indentation and line breaks, so nested objects and arrays are easy to read. Keys keep their original order.

Minifying

Minify removes all insignificant whitespace and produces the smallest text that represents the same data — useful before pasting JSON into configuration files or API payloads. If the result has to travel through a text-only channel, encode it with the Base64 encoder.

Assumptions and edge cases

  • Only whitespace changes: keys, values, and their order are preserved exactly as parsed.
  • Any valid JSON value works — objects, arrays, strings, numbers, booleans, and null.
  • Numbers are parsed as JavaScript numbers, so very large integers may lose precision when the result is re-printed.
  • Duplicate keys keep the last value, matching JSON.parse behavior in browsers.
  • When the input is invalid, the message shows the line and column where parsing stopped when that position can be determined, and the last valid output stays in the output pane.
  • The input is only parsed as data — never evaluated — and results are rendered as plain text.
Esc