JSON Formatting and Validation: Practical Examples

Learn JSON syntax, distinguish formatting from validation, and compare nested configuration changes in a browser.

What a formatter does

A JSON formatter parses text to check whether it follows JSON syntax and then displays it with consistent indentation. Formatting does not prove that an API will accept the document. A service may require particular keys, data types or a schema beyond basic JSON syntax.

Valid JSON example

Try {"user":{"id":7,"active":true},"tags":["new","trial"]}. A formatter should produce an indented object containing a nested user object and a two-item array. Double quotes are mandatory for keys and string values. true, false and null are lowercase keywords.

Frequent syntax problems

The text {name:"Sam"} is not valid JSON because name is not quoted. A trailing comma after the last object property is invalid. Single-quoted strings are invalid JSON. JSON also does not support comments. Fix these before passing the data to an application.

Compare configurations without formatting noise

Suppose the first file says {"cache":{"ttl":60},"enabled":true} and the second says {"cache":{"ttl":120},"enabled":true}. JSON Compare should report a change at cache.ttl, even if one input uses different indentation or whitespace.

Security and limitations

Never paste API secrets or production credentials into unknown web tools. OpenToolKit’s formatter runs its parsing logic in the browser. Even valid JSON may contain information you should not share. Very large documents can become slow to render.

Related tools

Use JSON Compare for differences between two valid JSON values, and CSV to JSON when data starts in a table.

Open the relevant free tool →