JSON Formatter & Validator

Beautify or minify JSON, or validate it and find out exactly what is wrong. Syntax errors are reported with a line, a column and a short explanation instead of a cryptic parser message.

Formatting options
Mode
String handling
Mode
Paste JSON hereโ€ฆ

Comments and trailing commas are rejected; JSON5 and JSONC are not supported. Your JSON never leaves the browser โ€” useful when it contains tokens or keys.

How to use

  1. Paste your JSON into the box.
  2. Pick a mode: Beautify to indent it, Minify to strip whitespace, or Validate only to check it.
  3. Choose an indent of 2 spaces, 4 spaces or a tab, and optionally sort the object keys.
  4. Copy the result or download it as a .json file.

Details

Most JSON errors are not exotic. A trailing comma added out of habit, a comment left in a config file, a key written without quotes, or a stray BOM at the start of a file pasted from elsewhere โ€” these account for the majority of failures, and a generic โ€œunexpected tokenโ€ message rarely tells you which one you are looking at. This validator identifies the kind of mistake and explains it in plain language.

Formatting is non-destructive to your data: numbers keep their original literal text where the parser allows it, object key order is preserved unless you explicitly ask for it to be sorted, and no fields are added or removed. Minifying only removes insignificant whitespace, so a minified document is byte-for-byte equivalent to the beautified one.

FAQ

Why does it reject comments and trailing commas?

Because they are not valid JSON. JSON5, JSONC and JavaScript object literals all allow comments or trailing commas, but the JSON specification does not, and strict parsers โ€” including the ones in most APIs โ€” will reject them. The validator deliberately reports these as errors rather than silently stripping them, so what you ship is what you tested.

How accurate is the error position?

The tool runs its own scanner rather than relying only on the built-in parser, so it can identify the category of mistake โ€” an unclosed bracket, a single-quoted string, an unquoted key, an invalid escape, a raw control character โ€” and point at the exact offset. The position is then converted to a line and column and the surrounding text is shown with a caret under the offending character.

What is the large-integer warning about?

JSON numbers are parsed as IEEE 754 double-precision values, which can represent integers exactly only up to 2^53โˆ’1. Beyond that, digits can be silently lost. Identifiers such as tweet IDs, database snowflake IDs or payment amounts in minor units are the usual victims. If you see the warning, keep those values quoted as strings.

Can I escape or unescape a JSON string?

Yes. Escape mode takes raw text and produces a properly escaped JSON string literal, which is handy for embedding a block of text as a single value. Unescape mode goes the other way and will tell you if the input is not a valid string literal.