JMESPath Tester
Test a JMESPath expression against JSON and see the result as formatted JSON. Write expressions such as locations[?state == 'WA'].name | sort(@) to filter, project and reshape data. JMESPath is the query language used by the AWS CLI --query option and Azure CLI, so this is a quick way to get such a query right.
Frequently asked questions
What is JMESPath?
JMESPath is a query language for JSON with a formal specification. It selects values with paths such as a.b, filters arrays with [?condition], projects lists with [*] and transforms data with functions such as sort_by, length and join.
Where is JMESPath used?
The AWS CLI uses it for the --query option, the Azure CLI uses it for --query as well, and Ansible offers it through the json_query filter. Test an expression here, then paste it into your command.
What does the result look like when nothing matches?
JMESPath returns null when a path does not exist, and an empty array when a filter keeps no items. The tool prints exactly that value, so null in the result means the expression found nothing.
How do I write a string literal in a filter?
Use single quotes for raw strings, for example [?name == 'web']. Values in backticks are JSON literals, such as `10` or `true`. Double quotes are for identifiers with special characters, such as "first-name".
Which functions are available?
All functions of the JMESPath specification, including abs, avg, contains, ends_with, join, keys, length, map, max_by, merge, min_by, not_null, reverse, sort, sort_by, starts_with, sum, to_array, to_number, to_string, type and values.
Why do I get an error about types?
JMESPath functions check the types of their arguments. For example, abs on a string fails with a message naming the expected type. Convert values first with to_number or to_string, or filter out items of the wrong type.