What Is JSON Format? Complete Beginner's Guide
What JSON Is and Where It Came From
JSON (JavaScript Object Notation) is a lightweight data interchange format. Proposed by Douglas Crockford in 2001, it was originally based on JavaScript object syntax but quickly evolved into a universal data format independent of any programming language.
Today, JSON is the de facto standard for internet data exchange. When you refresh a message feed in a mobile app, load dynamic content on a web page, or call any Web API โ the data being transmitted is almost always JSON format.
Basic JSON Syntax Rules
JSON syntax is extremely concise with only a few rules: data is composed of key-value pairs, with key names always in double quotes; data separated by commas; curly braces {} denote objects; square brackets [] denote arrays; strings in double quotes; numbers without quotes; boolean values as true/false; null values as null.
{
"name": "Alice",
"age": 30,
"isStudent": false,
"scores": [95, 87, 92],
"address": {
"city": "Beijing",
"zip": "100000"
},
"nickname": null
}
The Six Data Types JSON Supports
- String: Text in double quotes, e.g.,
"hello","2025-01-01" - Number: Integer or float, e.g.,
42,3.14,-100 - Boolean: Only
trueorfalse - Array: An ordered list of values, e.g.,
[1, "two", true] - Object: An unordered collection of key-value pairs, e.g.,
{"key": "value"} - null: Represents an empty or absent value
Note: JSON does not support comments, single-quoted strings, a date type (dates are typically represented as strings), undefined, or functions. These restrictions keep JSON concise and cross-language compatible.
JSON vs XML: Why Did JSON Win?
Before JSON, XML was the primary format for Web data exchange. Why JSON replaced XML: more concise (same data is typically 30-50% smaller in JSON); more readable (structure closer to natural language); easier for programming languages to parse (native JavaScript support, mature libraries in all languages); no XML's verbose open/close tags.
XML still has usage in some contexts (like Office document formats, certain enterprise systems), but in modern Web APIs, JSON is absolutely dominant.
JSON in Web Development Applications
JSON is everywhere in web development: REST API responses are almost entirely JSON; package.json is the Node.js project configuration standard; browser localStorage and sessionStorage typically store JSON strings; appsettings.json is the .NET application configuration file; databases like MongoDB use BSON (a JSON-like format) for document storage.
Reading, writing, and understanding JSON is a foundational skill for modern developers โ whether you're in frontend, backend, or DevOps, you'll inevitably work with JSON constantly.
How to Validate That JSON Is Valid
JSON syntax rules are strict. Common errors include: key names not enclosed in double quotes (common for beginners used to writing {name: "Alice"}); unescaped special characters in strings; trailing commas ([1, 2, 3,]); comments (JSON doesn't allow them).
Online JSON formatting tools can instantly validate JSON syntax and highlight error locations โ an essential development tool for quickly diagnosing JSON errors.
JSON's Limitations
Despite its popularity, JSON has limitations: no binary data support (requires Base64 encoding, adding ~33% size); large JSON files consume significant CPU to parse; no comments support (makes configuration files hard to annotate โ JSONC and JSON5 extensions address this); number precision issues (integers exceeding 15 digits may lose precision); no circular reference support.
For specific scenarios, other formats may be better: Protocol Buffers for high-performance binary transmission; MessagePack for compact binary JSON; YAML for human-readable configuration files; CSV for pure tabular data.
Try the free tool now
Use Free Tool โ