Skip to main content

JSON Structure Guide - Learn JSON Formatting Best Practices

Complete guide to JSON structure, syntax, and data types. Learn objects, arrays, strings, numbers, booleans, and null values with examples.

What is JSON?

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write, and strictly follows the RFC 8259 standard.

Data Types

JSON supports the following native data types:

  • String A sequence of characters enclosed in double quotes (e.g., "Hello").
  • Number Integer or floating-point (e.g., 42, 3.14).
  • Boolean true or false.
  • Null Represents an empty value (null).
  • Array An ordered list of values enclosed in square brackets ([]).
  • Object A collection of key/value pairs enclosed in curly braces ({ }).

Syntax Rules

{
  "string": "Keys must be double-quoted strings",
  "number": 123,
  "boolean": true,
  "null_value": null,
  "array": [
    "No trailing commas are allowed in the last item",
    2
  ],
  "object": {
    "nested": "structures work fine"
  }
}
Tip: JavaScript allows single quotes and trailing commas, but strict JSON does not. Our validator helps you catch these common errors automatically.

Specifications & Standards

JSON is defined by several standards that have evolved over time. While they are mostly identical, understanding the differences can be helpful for strict compliance.

Current RFC 8259

The current IETF standard that obsoletes RFC 7159. It specifies the application/json media type and defines JSON as a data-interchange format.

View RFC 8259 Reference

RFC 7159 & RFC 4627

Earlier versions of the JSON specification. RFC 7159 unified multiple previous documents, while RFC 4627 was the original RFC that first registered the media type.

ECMA-404

The Ecma International standard (4th edition, 2017) defines the syntax of JSON. It is 100% compatible with RFC 8259.

View ECMA-404 Standard