JSON Formatter & Validator

Pretty-print, minify, and validate JSON.

This takes messy, minified, or hand typed JSON and either formats it with readable indentation or shrinks it down as small as possible. Along the way it checks the syntax, catching a missing comma or an unmatched bracket immediately instead of leaving you to spot it by eye in a wall of text.

How to use it

  1. Paste your JSON into the box.
  2. Click pretty print for readable indentation.
  3. Click minify instead if you want the smallest version for production.
  4. Read the error message if there's a syntax problem.
  5. Copy the result once it looks right.

When it helps

  • Making a minified API response readable so you can actually understand its structure while debugging.
  • Minifying a config file before shipping it to save a bit of space.
  • Validating hand written JSON before pasting it into code, catching a missing comma early.
  • Formatting a payload before sharing it with a teammate.
  • Cleaning up JSON copied from a terminal that has inconsistent spacing.

Good to know

  • Always validate before sending JSON to an API. A trailing comma is a common reason requests fail.
  • Use the readable version while developing, and minify only right before shipping.
  • Read the error message carefully. It usually points close to where the problem actually is.
  • When debugging an API integration, pretty print the raw response first to spot which field is missing or malformed before diving into your own code's parsing logic.
  • When comparing two JSON responses that should be similar, pretty print both first, since it's much easier to visually compare formatted structures than two dense single line blocks.

Questions

What's the difference between pretty printing and minifying?

Pretty printing adds line breaks and indentation so a human can read it easily. Minifying strips all the extra whitespace to get the smallest file size for machines to parse.

Why does it say my JSON is invalid?

JSON has strict rules. Every key and string needs double quotes, no trailing commas are allowed, and every bracket has to match. The error message points to roughly where the problem is.

Can this handle a really large JSON file?

Yes, though a file that's many megabytes might take a moment longer since it's parsed in your browser rather than on a server.

Does this support JSON5 or JSONC with comments?

No, this formats and validates strict, standard JSON, which doesn't allow comments or trailing commas. A JSON5 file would need those removed first to be treated as valid JSON here.

Can I format deeply nested JSON without it becoming unreadable?

Pretty printing indents every level consistently, and while very deep structures still need scrolling, consistent indentation makes it much easier to track which bracket closes which.

Does the order of keys in an object matter to this tool?

No, it preserves whatever order the keys appear in your input. JSON itself doesn't guarantee key order matters, though this tool won't reorder them for you either.