JSON
JSON (JavaScript Object Notation) is a lightweight, text-based data format that represents structured data as key-value pairs and ordered lists, widely used for exchanging data between servers and web applications.
Definition
JSON (JavaScript Object Notation) is a lightweight, text-based data format that represents structured data as key-value pairs and ordered lists, widely used for exchanging data between servers and web applications.
Overview
JSON grew out of JavaScript's object literal syntax but is now a language-independent data format supported natively or via libraries in virtually every programming language. It represents data using just a handful of building blocks — objects (`{}`), arrays (`[]`), strings, numbers, booleans, and null — which makes it easy for both humans to read and machines to parse, and considerably lighter than older formats like XML. JSON became the default payload format for REST APIs largely because JavaScript running in the browser can parse it natively with `JSON.parse()`, avoiding the extra XML-parsing step earlier web services required. It's also the underlying format for many configuration files, NoSQL document stores, and log formats, and it underlies request/response bodies for most modern web and mobile backends built with frameworks like Node.js or Express. JSON has some deliberate limitations — no comments, no support for dates or binary data as native types, and no schema enforcement out of the box — which has led to companion specifications like JSON Schema for validation and formats like YAML that add comments and less-punctuation-heavy syntax for cases like configuration files where human editing matters more than machine efficiency.
Key Features
- Human-readable, text-based key-value and array structure
- Native parsing support in JavaScript and virtually every other language
- Lightweight compared to XML, with less syntactic overhead
- De facto standard payload format for REST and many GraphQL APIs
- No native comments, dates, or binary types
- Extensible via companion specs like JSON Schema for validation
Use Cases
Frequently Asked Questions
From the Blog
Working With JSON in Python
Python's json module converts between JSON text and Python objects with four core functions. Learn to parse, create, read, and write JSON with practical examples.
Read More ProgrammingJavaScript Objects and JSON Explained
JavaScript objects store data as key-value pairs, and JSON is a text format for exchanging that data. Learn how they relate, differ, and convert between each other.
Read More AI & TechnologyHow to Force Reliable JSON Output From a Language Model
Reliable JSON comes from constrained decoding where the provider supports it, a tool or schema definition where it does not, and a validate-and-repair loop behind both. This article compares the three approaches, shows where each fails, and gives the parsing defences you still need.
Read More ProgrammingPython File I/O: Reading and Writing Files
Almost every real Python program reads or writes files — logs, configs, CSVs, JSON, reports. This guide covers text files, CSV, JSON, binary files, and the modern pathlib approach, with best practices for safe file handling.
Read More