What is JSON? A Complete Guide for Beginners (2026)

Learn everything about JSON (JavaScript Object Notation): what it is, how to read it, syntax rules, and why it is the standard for web APIs.

JSON (JavaScript Object Notation) has become the de-facto standard for data exchange on the web. Whether you are building a React frontend, a Python backend, or configuring a VS Code environment, you will encounter JSON.

In this guide, we’ll break down exactly what JSON is, why we use it, and how to read and write it correctly.

What is JSON?

JSON stands for JavaScript Object Notation. It is a lightweight data-interchange format that is easy for humans to read and write, and easy for machines to parse and generate.

Despite its name, JSON is language-independent. While it was derived from JavaScript, code for reading and generating JSON data exists in practically every programming language, including Python, Java, C#, Go, and PHP.

Key Characteristics

  • Text-based: JSON is just a string of characters.
  • Lightweight: It has very little overhead compared to formats like XML.
  • Self-describing: A human can look at it and understand the data structure.

A Simple Example

Here is what a typical JSON object looks like. It represents a user profile:

{
  "id": 1024,
  "name": "Jane Doe",
  "isVerified": true,
  "roles": ["admin", "editor"],
  "contact": {
    "email": "jane@example.com",
    "phone": null
  }
}

As you can see, it looks very similar to a JavaScript object or a Python dictionary.

JSON Syntax Rules

JSON is strict. Unlike JavaScript, where you can be flexible with quotes and commas, JSON has specific rules you must follow. If you break them, the JSON is “invalid” and parsers will reject it.

1. Data is in Name/Value Pairs

Data is written as "key": value.

  • The key (name) must always be a string enclosed in double quotes ("").
  • The value can be a string, number, boolean, array, object, or null.

Correction: { name: "Jane" } is invalid (missing quotes on key). { "name": "Jane" } is valid.

2. Data is Separated by Commas

Each name/value pair is separated by a comma. However, trailing commas are not allowed.

// INVALID ❌
{
  "name": "Jane",
  "age": 25,
}

// VALID ✅
{
  "name": "Jane",
  "age": 25
}

3. Curl Braces Hold Objects

Curly braces {} hold objects. An object is an unordered set of name/value pairs.

4. Square Brackets Hold Arrays

Square brackets [] hold arrays. An array is an ordered collection of values.

{
  "colors": ["red", "green", "blue"]
}

JSON Data Types

JSON supports only the following specific data types:

  1. String: Text enclosed in double quotes. "Hello World"
  2. Number: Integers or floating-point. 42, 3.14 (No NaN or Infinity)
  3. Boolean: true or false
  4. Null: A generic null value. null
  5. Object: Another JSON object. { "nested": "value" }
  6. Array: A list of values. [1, 2, 3]

What’s missing? JSON does not support:

  • Functions
  • Dates (usually stored as ISO 8601 strings like "2026-02-06T12:00:00Z")
  • Undefined

JSON vs. XML

Before JSON, XML (eXtensible Markup Language) was the standard. Here is a comparison:

JSON:

{
  "name": "Jane",
  "role": "admin"
}

XML:

<user>
  <name>Jane</name>
  <role>admin</role>
</user>

Why JSON won:

  1. Less Verbose: JSON is shorter and uses less bandwidth.
  2. Faster Parsing: Browsers can parse JSON natively and instantly.
  3. Easier Data Access: In JavaScript, user.name is easier than traversing an XML DOM tree.

Common JSON Errors

Even experienced developers make mistakes with JSON. Here are the top 3:

  1. Using Single Quotes: JSON must use double quotes. {'key': 'value'} is strictly invalid.
  2. Trailing Commas: Leaving a comma after the last item in a list will break many parsers.
  3. Comments: Standard JSON does not support comments (// or /* */). You cannot add notes to a standard JSON file.

Need to Format or Validate JSON?

If you have a messy JSON string or aren’t sure if your syntax is correct, use a JSON Formatter. Tools like Kunji.dev can:

  • Validate: Instantly tell you if you missed a comma or quote.
  • Beautify: Indent messy one-liners so they are readable.
  • Minify: Remove whitespace to save space.

Conclusion

JSON is the language of the web. Understanding its simple syntax rules—double quotes, no trailing commas, specific data types—is essential for modern development. Whether you are configuring a server or debugging a REST API, these fundamentals will serve you well.