What JSON is and why formatting matters
JSON (JavaScript Object Notation) is a plain-text format for structured data, defined by RFC 8259 and ECMA-404. It has become the default language of web APIs, configuration files, log pipelines, and NoSQL databases because it is simple to read and almost every programming language can parse it. A JSON document is built from just six kinds of values: objects, arrays, strings, numbers, the literals true and false, and null.
Machines do not care about whitespace, so APIs usually return JSON minified onto a single line to save bandwidth. That is efficient for transport but very hard for people to read. A formatter re-indents the document so that every nested object and array starts on its own line, which makes the hierarchy obvious at a glance. Minifying does the opposite: it strips all optional whitespace so the payload is as small as possible before you paste it into a request, an environment variable, or a test fixture.
The syntax rules that trip people up
Most JSON parse errors come from habits carried over from JavaScript, Python, or YAML. Object keys must always be wrapped in double quotes; single quotes are not valid anywhere in JSON. Trailing commas after the last item of an object or array are not allowed, even though JavaScript accepts them. Comments are not part of the specification, so a // or /* */ line will break strict parsers.
Strings must use double quotes and escape special characters with a backslash, for example \" for a quote, \\ for a backslash, and \n for a newline. Raw control characters such as a literal tab inside a string are invalid. Numbers cannot have leading zeros (007 is invalid), cannot start with a plus sign or a bare decimal point, and the values NaN and Infinity do not exist in JSON. The literals true, false, and null must be lowercase.
When a parser fails, the reported position usually points just after the real mistake. If the error says unexpected token at line 12, look at the end of line 11 for a missing comma or an extra trailing comma first.
Reading validation errors effectively
A good workflow is to fix the first error only and re-validate, because a single missing bracket can cascade into dozens of misleading messages further down the document. Bracket mismatches are easiest to find with an indented view: when indentation suddenly drifts left or right, the unbalanced brace is usually just above that point.
Copying JSON out of logs, chat tools, or word processors can introduce invisible problems. Smart quotes (curly quotation marks) look almost identical to straight quotes but are different characters, and non-breaking spaces or a byte order mark at the start of a file can also cause failures. If a document looks correct but will not parse, retype the quotes around the reported position.
Large numbers, duplicate keys, and other edge cases
The JSON specification does not limit number size, but JavaScript stores numbers as 64-bit floating point values, which can only represent integers exactly up to 9,007,199,254,740,991. Database IDs and financial values larger than that can silently lose precision when parsed in a browser. Many APIs send such values as strings for exactly this reason, and it is worth checking how your consumers handle them.
Duplicate keys inside the same object are technically allowed by the grammar but their behavior is undefined: most parsers keep the last value and discard the others without warning. If a configuration value seems to be ignored, search the object for a second copy of the same key.
Finally, remember that formatting never changes meaning. Key order, indentation width, and line breaks are cosmetic, so a pretty-printed and a minified version of the same document are equivalent. If you need to compare two payloads that differ only in layout, normalize both with the same indentation first and then use a diff tool.