JMESPath Tester

Test JMESPath queries — the language of the AWS CLI’s --query — on your JSON, checked against the official compliance suite.

JMESPath Tester

On this device
The original JMESPath, as used by the AWS CLI’s --query and the Azure CLI. Literals go in backticks: `30`.

JSON

0 characters

Result

Paste JSON and type an expression, or pick an example above.

How is this calculated?
JMESPath specification (jmespath.org), evaluated by jmespath.js — the reference implementation — and tested on the official compliance suite.

Runs in your browser — nothing you enter leaves this device.

About this tool

What it does

JMESPath is a query language for JSON: one short expression picks out, filters, reshapes and summarises values. It is what the AWS CLI’s --query option and the Azure CLI’s --query speak, and Ansible’s json_query filter too, so most people meet it trying to pull one field out of a long command output. Paste the JSON, type an expression, and the result appears as you type. This is the original JMESPath specification, evaluated by its reference JavaScript implementation and checked here against all 851 cases of the official compliance suite — so an expression that works here works the same in the AWS CLI.

How to use it
  1. Paste JSON — for example the output of an aws ec2 describe-instances --output json command — or open a file.
  2. Type an expression, or pick one of the examples above the boxes to see the common shapes: lists, filters, multiselect objects, functions.
  3. Read the result as JSON. Copy it, or download it as result.json.
  4. When the expression has a mistake, the message under it says what kind — most often a literal number that needs backticks.
Limits and your data
  • This is the original JMESPath, as in the AWS and Azure CLIs. The newer JMESPath Community edition adds functions such as let(), items() and group_by(); those are reported as unknown here rather than guessed at.
  • Numbers are evaluated as JavaScript doubles, as in every JavaScript JMESPath. An integer above 2^53 — a large ID — would be rounded; the tool warns when your JSON has one, so you know to treat numbers in the result as approximate.
  • A query that runs longer than 5 seconds is stopped. Filter before projecting, or use JSON Studio for files over 5 MB.
  • Everything runs in your browser, in a background worker. Cloud command output often names accounts, hosts and keys; nothing you paste is uploaded, stored or logged.

Questions

Why does people[?age > 30] give an error?

In JMESPath a bare 30 is not a number. Literal JSON values go in backticks — people[?age > `30`] — and plain strings in single quotes, as in [?State.Name == 'running']. Double quotes mean a quoted field name, not a string.

What is the difference between [] and [*]?

[*] projects over a list and keeps its shape; [] does the same but also flattens one level of nesting. Reservations[].Instances[] turns a list of lists of instances into one flat list, which is usually what you want from AWS output.

How do I turn the result into a table for the AWS CLI?

Use a multiselect hash, such as Reservations[].Instances[].{id: InstanceId, type: InstanceType}, then pass --output table to the CLI. The same expression shows the JSON here.

Is JMESPath the same as JSONPath?

No. Both query JSON, but the syntax differs: JSONPath starts at $ and is standardised as RFC 9535; JMESPath has no $ and adds projections, multiselect and functions. The JSONPath tool on this site follows RFC 9535.