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
Python 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 Learn Through HobbiesLearn Node.js Through Building a Music API
Node.js is JavaScript on the server, and building a REST API for your music collection is the perfect first project. This guide covers Express routes, middleware, JSON responses, and deploying to a free hosting service — all by building an API for a music playlist.
Read More