Skip to main content

jq Playground

Run jq, JMESPath and JSONPath queries on your JSON with live results, 20 ready examples and a cheatsheet. Private, runs in your browser.

JSON data

Stays in your browser
{"users":[{"name":"Ada","age":36,"city":"London"},{"name":"Grace","age":45,"city":"New York"},{"name":"Linus","age":28,"city":"Helsinki"}]}

Result

2 resultsProcessed locally

jq cheatsheet

.the whole input
.a.bfield a, then b
.[0] .[-1]first and last item
.[]every item of an array or object
.[2:5]a slice of an array or string
a | bpipe the output of a into b
a, bboth outputs
select(.x > 1)keep items that match
map(.x) [.[] | .x]transform every item
{a: .x, b}build an object
sort_by(.x) group_by(.x) unique_by(.x)order and group
length keys add min maxcommon helpers
to_entries from_entries with_entries(f)work with keys
"\(.a) is \(.b)"string interpolation
@csv @tsv @json @base64 @uriformat an array or value
if c then a else b endcondition
.a // "default"a default for null or false
reduce .[] as $x (0; . + $x)fold a list
-r -c -s --arg name valueraw output, compact, slurp, variable

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to JSON Visualizer, JSON Editor or JSON Parser.

Free Online jq Playground: jq, JMESPath and JSONPath

Paste JSON, write a query and see the result as you type. Try the same question in jq, JMESPath or JSONPath, or start from one of 20 ready examples. It gives developers a quick browser-based way to solve a focused jq playground task before moving the result into a project.

How to use the playground

Pick a query language, paste your JSON on the left and type a query. The result updates about a third of a second after you stop typing. Choose an example to load both data and query, and open the cheatsheet for the syntax of the language you picked.

jq in one minute

jq reads JSON and applies a filter. .users[] walks the list, select(.age > 30) keeps matches and .name picks a field; you chain them with |. Use -r to print plain text instead of quoted strings.

Worked example

Data {"users":[{"name":"Ada","age":36},{"name":"Linus","age":28}]} with the query .users[] | select(.age > 30) | .name and -r prints:

Ada

Common mistakes

  • Backticks matter in JMESPath: a number in a filter is written `30`, a string with single quotes.
  • jq prints one result per line. To get one array, wrap the query in [ ... ].
  • JSONPath here supports property names, indexes, * and ... Filters such as [?(@.price > 10)] are not supported yet.

Frequently asked questions

Is this the real jq?
It is a jq interpreter written for this site that covers the language most queries use: paths, pipes, select, map, sort_by, group_by, object and array construction, string interpolation, reduce, try, def, @csv and the other @formats. Assignment (=, |=) and input/inputs are not supported yet, and the page says so when you use them.
Is my JSON uploaded?
No. Queries run in a background task in your browser and are stopped after 5 seconds if they do not finish. Nothing is sent to a server.
What do -r, -c and -s do?
-r prints strings without quotes, -c prints each result on one line, and -s reads several JSON documents into one array before the query runs. --arg values go in the Variables box, one name=value per line, and are used as $name.
Which should I use: jq, JMESPath or JSONPath?
jq is the most powerful and works well on the command line. JMESPath is used by the AWS CLI and Azure CLI. JSONPath is common in API tools and test frameworks. All three are here so you can try the same question in each.
How do I use this jq playground tool?
Use the interactive controls above; processing stays in your browser and the result is intended as a practical starting point for development work.

More Formatters & Parsers

View all Formatters & Parsers tools →