What is JSON? Full form, syntax rules and examples

Published 22 October 2026 · 6 min read · By the JSON XML Editor team

JSON stands for JavaScript Object Notation. It's a plain-text format for structured data: objects with named fields, lists, text, numbers and true/false values. Almost every web API sends and receives JSON, and many tools use it for configuration. It started in JavaScript but every mainstream language can read and write it.

The format is defined by two matching standards, RFC 8259 and ECMA-404. Files use the .json extension and the media type application/json.

A JSON example

{
  "id": 101,
  "name": "Ada Lovelace",
  "active": true,
  "balance": 250.75,
  "manager": null,
  "address": { "city": "London", "postcode": "N1 9GU" },
  "tags": ["admin", "beta"]
}

The whole document is an object (curly braces). Each field is a name in double quotes, a colon and a value. address is a nested object and tags is an array (square brackets).

The six JSON data types

TypeExampleNotes
String"London"Always double quotes. Escape quotes and backslashes with \.
Number101, 250.75, -3e8No leading zeros, no NaN or Infinity.
Booleantrue, falseLower case only.
Nullnull"No value". There's no undefined.
Object{ "city": "London" }Unordered name/value pairs; names are strings.
Array["admin", "beta"]Ordered list; items can be any type.

Syntax rules that cause most errors

Paste any JSON into the JSON validator to see each error with its line and column.

Big numbers lose precision in JavaScript

JavaScript stores numbers as 64-bit floating point, so integers above 9,007,199,254,740,991 (253 − 1) can silently change when parsed: JSON.parse('{"id": 9007199254740993}') gives 9007199254740992. APIs that use 64-bit IDs often send them as strings for this reason.

Reading JSON in code

JavaScript

const user = JSON.parse(text);
console.log(user.address.city);
const out = JSON.stringify(user, null, 2);

Python

import json
user = json.loads(text)
print(user["address"]["city"])
out = json.dumps(user, indent=2)

Java (Jackson)

ObjectMapper mapper = new ObjectMapper();
JsonNode user = mapper.readTree(text);
System.out.println(user.get("address").get("city").asText());

To work with typed objects instead, generate classes from a sample with JSON to Java, JSON to TypeScript or JSON to Python.

JSON vs XML in one table

JSONXML
Typical useWeb APIs, configurationDocuments, SOAP, enterprise integration
Data typesString, number, boolean, null, object, arrayEverything is text unless a schema says otherwise
Attributes, namespaces, commentsNoYes
SizeSmallerLarger (closing tags)

Need to move between them? Use XML to JSON or JSON to XML, and read XML to JSON conversion: the decisions that matter.

Try it: JSON Validator · JSON Formatter · JSON Viewer. Free, no sign-up.

More articles