JSON
JSON (JavaScript Object Notation) is a lightweight data interchange format based on JavaScript object literals, using key-value pairs and arrays.
Purpose
To provide a language-neutral, human-readable, easy-to-parse data interchange format, replacing XML as the dominant Web API format.
Mechanism
It builds on two structures: collections of key-value pairs (objects {}) and ordered lists (arrays []). Values are strings (double quotes), numbers, booleans, null, objects, or arrays. The syntax is strict (double quotes, no trailing commas, no comments). RFC 8259 requires UTF-8 and forbids a BOM.
Use cases
- Web API requests and responses
- Configuration files (package.json, tsconfig)
- NoSQL document storage (MongoDB)
- Log and event data
Examples
- Input
{"name":"Ada","age":36}OutputThe object {name:"Ada", age:36}Keys must be double-quoted
Common errors
- Using single quotes or unquoted keys (invalid JSON)
- Keys and string values must use double quotes
Related terms
YAML
YAML (YAML Ain't Markup Language) is a configuration-oriented data serialization format using indentation for hierarchy, supporting comments and references, and better suited to hand editing than JSON. GLOSSARY
XML
XML (Extensible Markup Language) is the W3C-standard markup language describing data with a tag tree, supporting namespaces, schema validation, and style transformation. GLOSSARY
JSON5
JSON5 is a superset of JSON that allows single quotes, unquoted keys, comments, trailing commas, NaN/Infinity, and hexadecimal numbers, making it better for hand-edited configuration. GLOSSARY
CBOR
CBOR (Concise Binary Object Representation) is a binary form of JSON, standardized in RFC 8949, more compact and supporting more data types. GLOSSARY
MessagePack
MessagePack is an efficient binary serialization format, similar to JSON but more compact, with multilingual support, used for RPC and caching. GLOSSARY
JSON Schema
JSON Schema is a vocabulary for describing the structure of JSON documents, defining types, constraints, and validation rules; it is the schema standard for JSON. GLOSSARY
Related tools
JSON Formatter
Format, minify, or sort JSON online. Free, private, and 100% client-side. TOOL
JSON Validator
Validate JSON and pinpoint syntax errors by line and column. Free, private, and 100% client-side. TOOL
JSON YAML Converter
Convert between JSON and YAML formats online. Free, private, and 100% client-side. TOOL
JSON XML Converter
Convert between JSON and XML formats online. Free, private, and 100% client-side. TOOL
JSON CSV Converter
Convert between JSON and CSV formats online. Free, private, and 100% client-side. TOOL
JSON to TypeScript
Infer TypeScript interfaces from JSON. Free, private, 100% client-side. TOOL