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 browserResult
jq cheatsheet
. | the whole input |
.a.b | field 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 | b | pipe the output of a into b |
a, b | both 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 max | common helpers |
to_entries from_entries with_entries(f) | work with keys |
"\(.a) is \(.b)" | string interpolation |
@csv @tsv @json @base64 @uri | format an array or value |
if c then a else b end | condition |
.a // "default" | a default for null or false |
reduce .[] as $x (0; . + $x) | fold a list |
-r -c -s --arg name value | raw 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.