All guides

Format JSON while checking syntax and important values

A small example explains formatting, minification, invalid JSON, and cases where JavaScript parsing can change data.

By ConvertWithMi · Updated · Editorial policy

Open JSON Formatter

Try a small valid document

Paste the sample below into the JSON Formatter and choose Format. The tool parses the input with JSON.parse and writes it back with JSON.stringify using two-space indentation. Choose Minify to remove optional whitespace from the serialized result.

The name remains a string, enabled remains a boolean, and tags remains an array. Formatting makes structure easier to read; it does not check your application’s required fields or validate against a JSON Schema.

{"name":"Sample","enabled":true,"tags":["alpha","beta"]}

Distinguish JSON from JavaScript

JSON object keys and string values use double quotes. Comments, trailing commas, undefined, and JavaScript expressions are invalid JSON. If you see a parse error, fix the input rather than expecting Format to guess the intended document.

A top-level number, string, boolean, or null can be valid JSON. The formatter is not limited to objects and arrays. An empty text field, however, is not a JSON value.

{"name":"Sample",}  ← invalid trailing comma

Preserve values that parsing can change

JSON.parse stores numbers as JavaScript numbers. Integers above Number.MAX_SAFE_INTEGER (9,007,199,254,740,991) may lose precision. If a large identifier needs exact digits, the data producer should encode it as a quoted string.

Duplicate object keys collapse to the final value during parsing. Whitespace, number spelling, and property order may change when the document is serialized. This formatter does not preserve the original bytes and should not be used to transform a digitally signed payload.

{"id":"9007199254740993"}
{"label":"first","label":"second"}  ← final label becomes "second"

Check the result before copying it

Compare important identifiers, number values, and required fields with the source before using the output. Browser parse-error wording can differ. Large documents can make the page slow because parsing and formatting happen in memory.

The formatter does not upload the pasted JSON through its formatting handler. Site analytics and other page requests are described separately in the privacy policy. Clipboard access may require a browser permission; you can select and copy the output manually if needed.

References

Report an error or suggest an improvement