jq vs JMESPath vs JSONata: Querying JSON Explained with Examples
Learn the three common JSON query languages side by side: paths, filters, projections and reshaping, with live examples on webhook payloads you can edit.

jq vs JMESPath vs JSONata: Querying JSON Explained with Examples
Sooner or later every developer, analyst or automation builder has a JSON document and needs a small part of it. The webhook from your git host contains the whole repository description when you only want the commit messages. The payment event nests the card country four levels deep. Three query languages have become the usual answer, and each lives in a different corner of the tool world. This guide compares them with the same examples, which you can run as you read in the JSON Transform Playground.
Where you meet each language
jq is a command line program, popular in shell scripts, CI pipelines and anywhere curl output is piped. JMESPath is built into the AWS and Azure command line tools as their query option, and into several SDKs and configuration systems, so it is the language for filtering cloud resource listings. JSONata is the expression language of several integration and workflow platforms, and it is often used to map one API's payload into another's format. Knowing which one your tool expects saves a lot of trial and error.
Picking a field
All three start with paths. To get the repository name from a push event, jq writes .repository.name with a leading dot, while JMESPath and JSONata both write repository.name without one. The difference looks tiny but it is the most common mistake when people move between them.
Working with lists
Lists are where the languages diverge. jq iterates explicitly: .commits[] produces each commit as a separate output, and .commits[].message produces each message. Wrap the expression in square brackets to collect the outputs into one array again. JMESPath uses projections: commits[*].message returns a list in one go. JSONata maps automatically, so commits.message already returns all messages. That automatic mapping is convenient, but it also means a single item may come back as a plain value rather than a list.
Filtering
To keep only Lee's commits, jq uses select inside a pipe: .commits[] | select(.author.name == "Lee") | .message. JMESPath has a filter projection written with a question mark inside square brackets, commits[?author.name=='Lee'].message, with string literals in single quotes. JSONata puts the condition in square brackets after the path, commits[author.name='Lee'].message, with a single equals sign. Three syntaxes for one idea, and the playground's Filter preset shows each.
Reshaping
Building new objects is jq's and JSONata's strength. In jq you write an object constructor and can compute keys from data; in JSONata the object syntax follows a path to produce one object per item. JMESPath offers multi-select hashes for the same purpose but has no general way to compute keys. If your task is converting one API format into another, jq or JSONata will feel more natural.
Aggregating
Counting and summing show the philosophies again. jq has length, add and reduce, so the total number of modified files is a reduce over commits that adds each list length. JMESPath has functions such as length, sum, max_by and sort_by, with the ampersand marking an expression passed to a function. JSONata uses dollar-prefixed functions like count, sum and join, and its grouping syntax with curly brackets after a path builds a summary object in one step.
Strings and output formats
jq can produce text directly. String interpolation inserts values into a sentence, and the csv and tsv formats turn arrays into lines for a spreadsheet, especially with the raw output switch. In the playground the raw and compact switches mirror the familiar command line flags, and whenever a query returns a list of objects a CSV button appears regardless of language.
A practical workflow
Start with the sample payload closest to your real data, or paste a real one; nothing leaves your browser. Press a preset to begin from a working query and edit it step by step, watching the output update with each keystroke. When a query is right, save it as a named snippet. Snippets live in your browser, and you can export the whole list to share with your team or keep beside the integration it belongs to.
Which one should you learn?
Learn the one your tools require first. For general command line work jq is the most powerful and widely available. For cloud CLIs, JMESPath is unavoidable and pleasantly small. For data mapping in integration tools, JSONata reads most like a spreadsheet formula. Once you know one, the side-by-side presets make the other two quick to pick up.



