JSON Formatter & Validator

JSON Formatter & Validator pretty print JSON data check JSON syntax online compact JSON whitespace
JSON Formatter & Validator

Check JSON before using it

Paste a JSON document, then choose Validate and format for readable two-space indentation or Minify for compact output. A valid result reports whether its top level is an object, array, string, number, boolean, or null.

Advertisement

Formatting and validation are connected

JSON can be reformatted only after it has been parsed successfully. This page uses the browser's strict JSON parser, so the same action checks syntax and produces normalized output. Formatting adds whitespace without changing keys, values, array order, or object membership. Minifying removes unnecessary whitespace but does not compress the underlying information.

Worked example

Enter {"project":"Maple","active":true,"ports":[80,443]}. The formatted result places properties and array values on indented lines. The minified result returns the compact form. Both represent the same object. Remove the comma between two properties and validation stops with a syntax error instead of guessing what you meant.

Rules that commonly cause errors

Property names and text values require double quotes. Single quotes, trailing commas, comments, undefined, NaN, and hexadecimal number literals are not part of JSON. A complete document may contain a scalar value, but many APIs expect an object or array. Valid syntax therefore does not prove that data matches an application's required schema.

Numbers and precision

Browser JSON parsing uses JavaScript numbers. Integers beyond the safe integer range can lose precision when parsed and serialized. This matters for database identifiers, financial minor units, and other long numeric tokens. Quote such values when their exact digits must survive, or use a system designed for arbitrary-precision JSON processing.

Privacy and limitations

Input remains in this browser tab and is not uploaded by the tool. The page does not fetch a URL, repair malformed data, validate JSON Schema, preserve original whitespace, preserve duplicate object keys, or explain an application's business rules. Parsing duplicate keys usually retains only the last value, so inspect questionable source data before trusting a normalized result.

JSON Formatter FAQ

Does formatting change array order?

No. Arrays stay in their original order.

Why did a large integer change?

It may exceed JavaScript's exact integer range. Represent exact identifiers as strings.

Can this validate JSON Schema?

No. It checks JSON syntax and reports the top-level type only.

Related tools

Categories

Tags