JSON is the most common format for sending data between programs. It is simple, but a single stray comma can make a whole file invalid. This guide shows what valid JSON looks like and how to find mistakes quickly.
The rules in one minute
Keys and text values must use double quotes. Items are separated by commas, but there must be no comma after the last item. Allowed value types are text, numbers, true, false, null, lists written in square brackets, and objects written in curly braces. Comments are not allowed.
The five most common errors
Single quotes instead of double quotes. A trailing comma after the last item. A missing comma between two items. Unquoted keys such as name: instead of "name":. And text copied from a word processor that contains curly quotation marks instead of straight ones.
Reading an error message
A validator reports the position where parsing failed, usually as a line and column. The real mistake is often just before that point, for example a missing comma on the previous line. Fix the first error, then validate again, because later errors may disappear.
Formatting and minifying
Formatting (also called pretty printing) adds indentation so people can read the structure. Minifying removes spaces to make the file smaller for sending. Both keep the data identical.
Converting between JSON and CSV
CSV is a flat table, while JSON can nest lists inside objects. A list of similar objects converts neatly to rows and columns. Deeply nested data needs flattening first, and values that contain commas must be quoted, which a good converter handles for you.
Privacy note
Do not paste secrets such as passwords or API keys into any online tool you do not trust. Browser-based tools keep your text on your device, but it is still a good habit to remove secrets from samples.