Validate and format JSON without confusing it with JavaScript

Fix syntax errors, choose readable or compact output and inspect important values.

Open this tool · All guides

Understand the settings

JSON is a data format with strict syntax. Object keys and strings use double quotes; comments, trailing commas, undefined and JavaScript expressions are not valid JSON. Formatting changes layout, not the intended data values.

Readable formatting adds indentation and line breaks. Compact formatting removes unnecessary whitespace outside strings. Whitespace inside a quoted string is data and must remain. The formatter preserves number spellings, including large integers, instead of round-tripping every numeric value through JavaScript floating-point numbers.

Syntax validation is not schema validation. A JSON document can be valid while missing a required field or containing a value your application does not accept. Duplicate object keys are also a portability concern because downstream parsers can disagree about which value wins; avoid them.

Step by step

  1. Paste JSON or load the on-page example.
  2. Choose formatted or compact output.
  3. If validation fails, inspect the reported location and nearby punctuation.
  4. Copy/download the result, then validate it against the receiving application’s requirements.

Fix a trailing comma

The text {"name":"Avery",} is invalid JSON because of the comma before }. Remove that comma to get {"name":"Avery"}. Do not remove commas between legitimate fields.

Limits and what to check

Troubleshooting

Single quotes fail

Single-quoted strings are permitted in JavaScript but not JSON. Use double quotes and escape embedded double quotes.

Valid JSON fails in my app

Check its schema, field names, required values and data types. Syntactic validity is only the first step.

A secret is still present after minifying

Minifying reduces whitespace; it is not redaction or encryption.

Related tools

Updated October 9, 2026. Report an issue with this guide.