HomeBlog › What is JSON? A Complete Guide for Devel…
developer

What is JSON? A Complete Guide for Developers and Non-Developers

May 8, 20269 min readBy My ToolKit

JSON is everywhere

If you have built a web application, used an API, written a configuration file, or saved settings in any modern app, you have encountered JSON. It powers the responses from virtually every web API, stores configuration for countless developer tools, and appears in package.json, tsconfig.json, settings.json, and thousands of other files. Understanding JSON well — its syntax rules, its types, its common patterns, and its limitations — is genuinely foundational knowledge for anyone working with software.

What JSON stands for and where it came from

JSON stands for JavaScript Object Notation. It was invented by Douglas Crockford in the early 2000s as a lightweight alternative to XML for transmitting data between web applications. The name reflects its origins: it looks like JavaScript object and array literals. However, JSON is completely language-independent — it is used in Python, Java, Ruby, Go, Rust, and every mainstream programming language, all of which have built-in support for reading and writing it.

The six JSON value types

JSON represents data using exactly six value types. Understanding these is the entire syntax of JSON:

String: a sequence of characters in double quotes. JSON must use double quotes — single quotes are not valid. Special characters must be escaped with a backslash.

Number: an integer or floating-point number, without quotes. 42, 3.14, -7, and 1.5e10 are all valid. There is no distinction between integers and floats in JSON.

Boolean: the values true or false, lowercase, without quotes. "true" in quotes is a string, not a boolean.

Null: the value null, lowercase. Represents the intentional absence of a value.

Array: an ordered list of values in square brackets, separated by commas. Elements can be any JSON value type, including other arrays and objects.

Object: an unordered set of key-value pairs in curly braces. Keys must be strings in double quotes, separated from values by colons, and pairs separated by commas.

That is genuinely everything. JSON has no dates, no comments, no functions, no undefined values, and no trailing commas. Its strictness is part of what makes it portable across every language and platform.

Common JSON mistakes that cause parse errors

JSON is unforgiving: parsers reject any syntax error immediately. These are the errors I encounter most:

Trailing commas — JSON does not allow a comma after the last item in an array or object. {"a": 1, "b": 2,} is invalid. This trips up developers used to JavaScript, which allows trailing commas in modern ES syntax.

Single-quoted strings — {"name": 'Alice'} is invalid. Only double quotes are permitted for both keys and string values.

Unquoted keys — {name: "Alice"} is valid JavaScript shorthand but not valid JSON. All keys must be quoted strings.

Comments — JSON has no comment syntax. // or /* */ produce parse errors. If you need comments in config files, look at JSONC (JSON with Comments), used by VS Code.

NaN and Infinity — these JavaScript numeric values have no JSON representation. JSON.stringify() converts them to null silently, which is often not the intended behaviour.

Reading and writing JSON in common languages

JavaScript: JSON.parse() to read, JSON.stringify() to write. Python: json.loads() to parse a string, json.load() for a file object, json.dumps() to produce a string. Go: the encoding/json package with json.Unmarshal and json.Marshal. Java: use the Jackson or Gson library — there is no standard library equivalent. All of these use the same underlying six-type data model.

Why a formatter is essential for working with JSON

Raw API responses are typically minified — all whitespace removed to save bytes. The result is an unreadable wall of text. My JSON formatter adds indentation and newlines instantly, shows syntax errors with the specific position, provides collapsible sections for large objects, and applies syntax highlighting so you can scan the structure at a glance. It runs entirely in the browser — nothing is uploaded anywhere, which matters when you are formatting responses that contain user data or API keys.

My JSON FormatterFree · runs in your browser · nothing uploaded
Open the tool →