DoItAl

Practical guide

JSON Formatting and Validation Explained

Separate valid JSON syntax from schema correctness, and understand number precision and duplicate-key differences in a parsed tree.

Formatting changes presentation

JSON Formatter indents valid JSON with two or four spaces. Minify removes insignificant whitespace. For example, {"items":[1,2],"active":true} can be displayed on several lines without changing its tokens.

JSON strings need double quotes, object keys need quotes, and comments and trailing commas are invalid. {"items":[1,]} fails syntax validation even if a JavaScript runtime accepts a similar array expression. A single value such as false or null is valid JSON too.

Syntax is not a data contract

A syntax check cannot tell you whether an API requires customer_id, whether a date has the right format, or whether a value is authorized. Compare the valid result with the receiving system’s schema and rules. Formatting does not repair a missing field or prove that a request will succeed.

DoItAl validates grammar with the browser parser, then formats original lexical tokens. Text exports therefore preserve key order, duplicate keys, numeric spellings such as 1e30, escape sequences, and integers too large for JavaScript Number to represent exactly.

Understand the tree preview

The optional tree is a parsed JavaScript view. It retains the last occurrence of a duplicate key and can round large integers. An input literal 9007199254740993 remains exact in DoItAl’s text output but may look different in a Number-based preview. Inspect the text export when exact identifiers matter.

The tree is deliberately bounded by input size, depth, and children per branch. Larger data can still use the full text result within the 1 MB input limit. Parsing and download stay local; do not paste private values into support emails when reporting a syntax problem.

Material update: