JMESPath cheat sheet

The everyday JMESPath expressions at a glance, over the team document. Press ▶ to run one.

The document the examples run on
{
  "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": [] }
  ]
}
QueryWhat it doesRun it
office.citya sub-expressionTry it
members[0]an array elementTry it
members[-1].namethe last elementTry it
members[1:3]a sliceTry it
members[*].nameproject a field from every elementTry it
members[*].skills[]flatten nested listsTry it
members[?age > `30`]a filter (numbers use backtick literals)Try it
members[?role == 'dev' && active]combined conditions (strings use quotes)Try it
members[?contains(skills, 'sql')].namea function in a filterTry it
members[*].{who: name, years: age}build objectsTry it
members[*].[name, age]build listsTry it
office.*every value of an objectTry it
length(members)countTry it
sort_by(members, &age)[*].namesortTry it
max_by(members, &age).namethe element with the largest valueTry it
join(', ', members[*].name)join into a stringTry it
members[*].skills | [0]a pipe ends a projectionTry it

All JMESPath lessons

About jsonquery

Query, format and learn JSON with jq, JSONPath, JMESPath and JSON Pointer. It is the engine of the desktop app, run in your browser.

Engine
The desktop app’s, compiled to WebAssembly
Licence
MIT (the engine and the app)
Source
GitHub
Contact
The contact form (private)
Public issues
GitHub
Legal
Privacy policy

Known limitations: a file over 10 MB opens read-only and one over 512 MB does not open here; the desktop app has no such limit.