{
"name": "Ada",
"active": true
}Objects are the most common top-level form for API payloads and configuration files.
Core JSON syntax, valid values, root structures, and foundational examples for working with JSON documents.
Understand what a complete JSON document can look like at the top level.
{
"name": "Ada",
"active": true
}Objects are the most common top-level form for API payloads and configuration files.
[
{ "id": 1 },
{ "id": 2 }
]Arrays are common for list-style payloads and exports.
"hello world"Many developers expect only objects or arrays, but any valid JSON value can be the root.
42This is valid JSON even though it is less common in practice.
nullUseful for understanding validators and parsers that accept any JSON value.
The most important rules people forget when writing JSON by hand.
{
"theme": "dark"
}`'theme': 'dark'` is valid in some JavaScript contexts but invalid JSON.
{
"name": "Ada",
"role": "admin"
}A trailing comma after the last property or array item is a frequent parse failure.
{
"debug": false
}Many configuration systems allow JSON-like files with comments, but plain JSON does not.
jq . input.jsonA fast way to validate and pretty-print JSON from a file.
python -m json.tool input.json > /dev/nullUseful on machines where Python is available but `jq` is not.