JSON Data Types

Beginner
⏱️ 11 min read
📚 Updated: May 2026
JSON / RFC 8259

What you’ll learn

JSON (JavaScript Object Notation) is a lightweight text format for exchanging data between browsers, servers, databases, and tools. Every JSON document is built from a small set of value types defined in RFC 8259.

This page walks through each type with short examples, then shows one nested document that mixes them the way real APIs do.

What is JSON?

JSON uses JavaScript–like literal syntax, but it is language independent. Data is expressed as a single JSON value at the top level—usually an object or an array—whose properties and elements use only the six types below.

The six JSON value types

A conforming parser recognises exactly these kinds of values. Anything else (for example a date type, undefined, or NaN) must be represented using one of these types plus an agreed convention.

String

Unicode text in double quotes, with escape sequences for control characters and quotes.

Number

Decimal digits; optional -, fraction, and exponent. No NaN or Infinity in strict JSON.

Boolean

Literals true and false (never quoted).

Null

Literal null for “no value” or unknown (not an empty string).

Array

Ordered list in [ ]; elements may have mixed types.

Object

Map of string keys to values in { }; order is not semantically meaningful to the spec.

String

Strings are sequences of Unicode characters wrapped in double quotes. Use backslash escapes for quotes, backslashes, newlines, and other control characters.

JSON
{
  "name": "John Doe",
  "message": "Hello, World!",
  "slug": "docs/api/overview"
}

Number

Numbers are not quoted. They may be integers, fractions, or use scientific notation with e or E.

JSON
{
  "age": 30,
  "height": 5.9,
  "scientific": 1.23e4
}

Boolean

Booleans are the lowercase literals true and false without quotes.

JSON
{
  "isStudent": true,
  "hasGraduated": false
}

Null

null represents an intentional empty value. It is not the same as omitting the key or using an empty string.

JSON
{
  "middleName": null
}

Array

Arrays are ordered lists in square brackets. Elements can be any JSON value, including nested arrays and objects.

JSON
{
  "fruits": ["apple", "banana", "cherry"],
  "numbers": [1, 2, 3, 4, 5],
  "mixed": ["text", 123, false, null]
}

Object

Objects are unordered collections of key–value pairs. Keys must be strings; values can be any type. Nest objects to model structured records.

JSON
{
  "person": {
    "firstName": "Jane",
    "lastName": "Doe",
    "age": 25,
    "address": {
      "street": "123 Main St",
      "city": "Anytown",
      "zipcode": "12345"
    },
    "phoneNumbers": ["555-1234", "555-5678"]
  }
}
1

Example: one document, every type

This payload combines strings, numbers, booleans, null, arrays, and nested objects—the shape you often see from REST APIs.

JSON
{
  "employee": {
    "id": 101,
    "name": "Alice",
    "email": "alice@example.com",
    "isManager": false,
    "department": null,
    "skills": ["JavaScript", "Python", "HTML", "CSS"],
    "projects": [
      {
        "name": "Project A",
        "deadline": "2026-06-30",
        "budget": 10000.5
      },
      {
        "name": "Project B",
        "deadline": "2026-12-31",
        "budget": 20000.75
      }
    ]
  }
}

The outer value is an object with one key, employee, whose value is another object. Arrays hold primitives in skills and objects in projects.

Key takeaways

1

JSON has exactly six value types: string, number, object, array, boolean, and null.

2

Object keys are always strings in double quotes; numbers and dates are carried as numbers or strings by convention.

3

Strict JSON rejects NaN, Infinity, trailing commas, and unquoted keys—watch what your serializer emits.

Frequently asked questions

No. Use a string (often ISO‑8601) or a numeric epoch, and document the meaning in your API or JSON Schema.
Yes. Each array position is an independent JSON value. Many style guides still recommend homogeneous arrays for easier validation and tooling.
No. JSON strings must use double quotes. Single quotes work in JavaScript object literals but not in JSON.
The JSON spec treats objects as unordered maps. Parsers may preserve insertion order in practice, but your application logic should not rely on key order across systems.

Next: JSON Rules

Once you know the types, learn the syntax rules that keep documents valid for every parser.

JSON Rules →
Did you know?

JSON text is built from exactly six kinds of value. There is no separate “date” or “binary” type in the core spec — you represent those as strings (often ISO‑8601) or Base64 in a string, and document the convention in your API or schema.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful