jsump.
Guides Fundamentals

What is JSON? The Definitive Guide

Understanding the backbone of modern web APIs, its strict syntax rules, and data types.

The Standard for Data Interchange

JSON (JavaScript Object Notation) is a lightweight, text-based, language-independent data interchange format. Despite its name, JSON is entirely language-agnostic and is supported natively by almost every modern programming language, from Python and Go to Rust and Java.

According to GitHub's State of the Octoverse, JSON remains the most widely used data format in open-source repositories. Its human-readable structure combined with easy machine parsing makes it ideal for configuration files, API payloads, and NoSQL databases like MongoDB.

Syntax Rules

JSON syntax is intentionally restrictive to ensure predictable parsing. Unlike JavaScript objects, JSON requires strict adherence to these rules:

  • Double Quotes: All keys and string values must be wrapped in double quotes ("). Single quotes are invalid.
  • No Trailing Commas: A comma after the last item in an array or object will cause a parse error in standard JSON parsers.
  • No Functions or Undefined: JSON is for data, not logic. You cannot serialize functions, and undefined is not a valid value (use null instead).

Example Payload

{
  "user_id": "usr_9f8e7d",
  "active": true,
  "login_count": 42,
  "roles": [
    "admin",
    "editor"
  ],
  "metadata": null
}

Data Types

JSON supports exactly six data types:

Type Description Example
String Unicode text wrapped in double quotes. "Hello World"
Number Integer or float. No octal or hex formats. 42.5
Boolean True or false. true
Null Represents an empty or intentional non-value. null
Object Unordered collection of key-value pairs. {"a": 1}
Array Ordered list of values. [1, 2, 3]

Tools for Working with JSON

If you're dealing with large or ugly JSON payloads, use our JSON Formatter to safely parse and pretty-print your data directly in your browser without sending sensitive information to a remote server.