What is JSON?

A complete guide to JavaScript Object Notation - the most popular data interchange format on the web.

JSON Definition

JSON (JavaScript Object Notation) is a lightweight, text-based data format used to store and exchange data. Despite its name, JSON is language-independent and can be used with virtually any programming language.

JSON was derived from JavaScript but has become the standard data format for web APIs, configuration files, and data storage. It's human-readable, easy to parse, and supported by every major programming language.

JSON Example

Here's a simple JSON example representing a user:

{
  "name": "John Doe",
  "age": 30,
  "email": "john@example.com",
  "isActive": true,
  "address": {
    "city": "New York",
    "country": "USA"
  },
  "hobbies": ["reading", "coding", "gaming"]
}

JSON Data Types

JSON supports six data types:

String

"Hello World"

Number

42, 3.14, -10

Boolean

true, false

Null

null

Array

[1, 2, 3]

Object

{"key": "value"}

Why Use JSON?

  • Human-readable: Easy to read and write compared to XML or binary formats
  • Lightweight: Minimal syntax means smaller file sizes
  • Universal support: Works with JavaScript, Python, Java, PHP, and every major language
  • Native to JavaScript: Parse and stringify with built-in methods
  • API standard: The default format for REST APIs and web services

Common Uses of JSON

Web APIs: Nearly all modern REST APIs use JSON to send and receive data between servers and clients.

Configuration files: Many applications use JSON for settings (package.json, tsconfig.json, etc.).

Data storage: NoSQL databases like MongoDB store data in JSON-like formats.

Data exchange: Sharing data between different systems and programming languages.

JSON Syntax Rules

  • • Data is in key/value pairs
  • • Keys must be strings in double quotes
  • • Values can be strings, numbers, booleans, null, arrays, or objects
  • • Data is separated by commas
  • • Objects are enclosed in curly braces {}
  • • Arrays are enclosed in square brackets []
  • • No trailing commas allowed
  • • No comments allowed in standard JSON

Try Our JSON Formatter

Format, validate, and explore your JSON data with our free online tool.

Open JSON Formatter