Testers

JSON Formatter

Pretty-print, validate and minify any JSON payload — catch syntax errors and copy clean, properly formatted output.

About JSON Formatter

Pretty-prints and validates JSON, taking minified or malformed input and either formatting it into readable, indented structure or pointing out exactly where the syntax is invalid. A single missing comma or unescaped quote in a large JSON payload can be tedious to spot by eye in its raw, unformatted form. Validation catches the syntax errors that would otherwise surface as a cryptic parser exception somewhere downstream, with a much clearer indication of where the actual problem is than most application-level JSON parsers provide.

Trailing commas after the last item in an array or object are valid in JavaScript object literals but not in JSON itself — one of the most common "looks fine, fails to parse" mistakes when JSON is hand-edited or copied from JS code.

📖 Read more in our Knowledge Base →

The JSON rules that trip people up

JSON (RFC 8259) is much stricter than JavaScript object syntax:

  • Keys and strings use double quotes only: {'a':1} is invalid.
  • No trailing commas after the last item.
  • No comments of any kind.
  • NaN, Infinity and undefined don't exist; use null or a string.
  • Control characters inside strings must be escaped: a raw tab or newline is an error, \t and \n are fine.

The error message points at the position where parsing stopped. The real mistake is often just before it, for example a missing comma at the end of the previous line.

Big numbers lose precision

JSON numbers are parsed as 64-bit floats in JavaScript, so integers above 9,007,199,254,740,991 (253−1) are rounded. A 19-digit ID such as a Twitter/X or Discord snowflake comes out slightly different after formatting. APIs that use such IDs usually send them as strings too; compare those, not the numbers.

Pretty-print vs minify

Pretty-printed JSON is for reading and diffs; minified JSON removes all whitespace for transport. Over HTTP with gzip or Brotli the size difference is small, so readability usually wins for config files.

On the command line

  • jq . file.json — format and validate; jq -c . to minify.
  • python3 -m json.tool file.json — no extra install needed.

Formatting happens in your browser; the JSON is not sent to our server. Decode tokens with the JWT Decoder.