Generated by DeepSeek V3.2| JSON | |
|---|---|
| Name | JSON |
| Extension | .json |
| Mime | application/json |
| Uniform type | public.json |
| Developer | Douglas Crockford |
| Released | 0 2002 |
| Genre | Data interchange |
| Extended from | JavaScript |
| Standard | ECMA-404, RFC 8259 |
JSON is a lightweight, text-based data interchange format derived from the syntax of the JavaScript programming language. It is language-independent but uses conventions familiar to programmers of the C-family of languages, including C++, Java, and Python. The format is easy for humans to read and write and easy for machines to parse and generate, making it a ubiquitous standard for web APIs and configuration files.
The format was popularized by Douglas Crockford in the early 2000s, building upon the object literal notation of JavaScript. It was formally specified in ECMA-404 and later in RFC 8259 published by the Internet Engineering Task Force. JSON's design goals prioritized simplicity and minimalism, leading to its rapid adoption over more complex formats like XML for many web service applications. Its role as a foundational technology for Ajax and modern single-page applications cemented its place in web development.
A valid document is built upon two primary structures: a collection of name/value pairs, often realized as an associative array, and an ordered list of values, known as an array. These structures are universal and are supported by most modern programming languages, including PHP, Ruby, and C#. The basic tokens include curly braces for objects, square brackets for arrays, and the use of colons and commas to separate names, values, and elements. Strings must be enclosed in double quotes, a strict rule that differentiates it from its JavaScript origins.
The format supports a limited set of data types, which contributes to its simplicity and interoperability. These include strings, numbers, booleans (true or false), null, objects, and arrays. Notably, it lacks native types for dates, functions, or undefined values, which are common in JavaScript; dates are typically serialized as ISO 8601 strings. This constrained type system ensures predictable parsing across different environments, from Node.js servers to Android applications.
While the format itself is schemaless, the need for data integrity in complex systems led to the development of JSON Schema, a vocabulary for annotating and validating documents. Tools like Ajv and libraries for Python and Java implement this specification to ensure data conforms to expected structure, content, and data types. This validation is crucial in contexts like OpenAPI definitions for APIs and configuration for platforms like Kubernetes.
Its primary use is in transmitting structured data between a server and a web application, serving as the de facto format for RESTful web APIs provided by companies like Twitter, GitHub, and Google. It is also extensively used for configuration files in tools such as npm, ESLint, and Visual Studio Code, and for serialization in NoSQL databases like MongoDB. The format's ubiquity is further evidenced by its support in major cloud computing platforms including AWS, Microsoft Azure, and Google Cloud Platform.
Compared to XML, it is less verbose and generally easier to parse, leading to faster processing and reduced bandwidth usage in web service communications. Unlike YAML, which emphasizes human readability for configuration, it has a stricter, simpler syntax that is less prone to ambiguity. However, it lacks the extensibility features and formal validation of XML through XML Schema or the commenting ability of YAML. For high-performance serialization, formats like Protocol Buffers from Google or MessagePack are often more efficient but are not human-readable.
Category:Data serialization formats Category:Open formats Category:Internet standards