What is JSON?

JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format that is easy for humans to read and write, and easy for machines to parse and generate. It is based on a subset of JavaScript syntax but is language-independent.

Quick Facts

Full NameJavaScript Object Notation
Created2001 by Douglas Crockford
SpecificationOfficial Specification

How JSON Works

JSON uses a simple structure of key-value pairs and ordered lists to represent data. Objects are enclosed in curly braces {} with comma-separated key-value pairs, where keys are strings in double quotes. Arrays are enclosed in square brackets [] with comma-separated values. JSON supports six data types: strings, numbers, booleans (true/false), null, objects, and arrays. Unlike XML, JSON has no closing tags, making it more compact and faster to parse.

Key Characteristics

  • Human-readable text format with minimal syntax
  • Language-independent but uses conventions familiar to C-family languages
  • Supports nested data structures (objects within objects, arrays within arrays)
  • No support for comments in the official specification
  • Strict syntax rules - keys must be double-quoted strings
  • Smaller file size compared to XML for equivalent data

Common Use Cases

  1. API responses and requests in web services (REST APIs)
  2. Configuration files for applications and tools
  3. Data storage in NoSQL databases like MongoDB
  4. Data exchange between client and server in web applications
  5. Package management files (package.json, composer.json)

Example

{
  "name": "John Doe",
  "age": 30,
  "isActive": true,
  "email": null,
  "skills": ["JavaScript", "Python", "SQL"],
  "address": {
    "city": "New York",
    "country": "USA"
  }
}

Related Tools on QubitTool

Related Concepts