{
"id": 101,
"name": "Ada"
}Objects are ideal for records with labeled fields.
Patterns for nested objects, arrays, list items, nullability, and common data-shape decisions in JSON.
Objects model named fields and records.
{
"id": 101,
"name": "Ada"
}Objects are ideal for records with labeled fields.
{
"user": {
"id": 101,
"profile": {
"city": "Austin",
"timezone": "America/Chicago"
}
}
}Nested objects group related data and reduce flat key sprawl.
Omitting a field is different from setting it to null.
{
"nickname": null
}A missing property can mean "unknown" or "not sent". `null` usually means explicitly empty.
Arrays model ordered collections of values or objects.
[
"red",
"green",
"blue"
]A useful pattern for tags, labels, and simple lists.
[
{ "id": 1, "name": "Ada" },
{ "id": 2, "name": "Linus" }
]Widely used for query results and exports.
JSON allows mixed types, but they are often harder to consume.
[1, "two", true, null]Prefer consistent item shapes unless you have a strong reason not to.
Print one property from every object in an array.
jq '.[].name' users.jsonGreat for inspecting list payloads quickly.