JMESPath · lesson 1 of 15 · Basics
Identifiers & missing values
A JMESPath expression is a path: office.city reads city inside office, with no leading . or $. A key that doesn't exist is not an error — the result is null.
Examples
Example 1A sub-expression
Document
{
"team": "Platform",
"office": { "city": "Berlin", "floor": 3 },
"members": [
{ "name": "Ada", "age": 36, "role": "lead", "active": true,
"email": "[email protected]", "skills": ["rust", "sql"] },
{ "name": "Linus", "age": 28, "role": "dev", "active": true,
"email": null, "skills": ["c", "shell"] },
{ "name": "Grace", "age": 45, "role": "dev", "active": false,
"skills": ["cobol"] },
{ "name": "Alan", "age": 41, "role": "qa", "active": true,
"email": "[email protected]", "skills": [] }
]
}Query
office.city
officeA top-level key..cityA sub-expression: thecitykey of that object →"Berlin".
Result
"Berlin"
Example 2A missing key
Document
{
"team": "Platform",
"office": { "city": "Berlin", "floor": 3 },
"members": [
{ "name": "Ada", "age": 36, "role": "lead", "active": true,
"email": "[email protected]", "skills": ["rust", "sql"] },
{ "name": "Linus", "age": 28, "role": "dev", "active": true,
"email": null, "skills": ["c", "shell"] },
{ "name": "Grace", "age": 45, "role": "dev", "active": false,
"skills": ["cobol"] },
{ "name": "Alan", "age": 41, "role": "qa", "active": true,
"email": "[email protected]", "skills": [] }
]
}Query
office.nopenopeA key that doesn't exist evaluates tonull— it is not an error.
Result
null
Good to know
- In the playground, pick JMESPath with the buttons above the query: a plain path like
office.cityis otherwise auto-detected as jq. Try it does this for you. - Keys with spaces or symbols go in double quotes:
"first name".