ToolsNova
Developer GUIDE · 4 MIN READ

JSON Formatting Explained: Common Errors and Fixes

Understand JSON rules, common syntax errors, and the difference between pretty-printing and minifying.

What JSON represents

JSON is a text format for objects, arrays, strings, numbers, booleans, and null. A valid example is {"name":"ToolsNova","active":true,"tags":["free","browser"]}. It is used in APIs, configuration, and data exchange.

JSON is not JavaScript source code. It does not allow comments, functions, undefined, or unquoted object keys.

Common errors

Both keys and string values must use double quotes. Standard JSON forbids trailing commas and requires balanced braces and brackets. For example, {"name":"A",} is invalid because of the trailing comma; {"name":"A"} is valid.

Remember that true, false, and null are lowercase. Backslashes inside strings need correct escaping.

Formatting versus minifying

Formatting adds whitespace and indentation for readability; minifying removes unnecessary whitespace. Neither operation fixes syntactically invalid JSON automatically.

JavaScript JSON parsing may lose exact precision for integers larger than its safe integer limit. Verify large identifiers and financial quantities carefully rather than assuming a formatter preserves their mathematical exactness.

Use the JSON Formatter

Paste the JSON, click Format or Minify, and read the validation message. If the input fails to parse, correct the reported problem and try again. Use Copy after checking the result.

ToolsNova runs this operation locally, with a 2-million-character input limit. Avoid publishing real credentials or private data in code examples.

A quick debugging checklist

Look for single quotes, trailing commas, unclosed strings, unescaped backslashes, illegal comments, and incorrect boolean spelling. Reduce a complex document to a smaller valid example if an error is difficult to locate.

TRY THE TOOL

JSON Formatter

Use our free browser-based tool to put the guide into practice.

Open JSON Formatter ↗
← All guidesExplore all 30 tools ↗