jq Playground
Query and transform JSON data with jq-like expressions. Filter, map, and transform your data interactively.
Supported Operations
⥠Basic Operations
.- Identity.foo- Property access.foo.bar- Nested access.[]- Iterate array.[0]- Index access
đ§ Functions
length- Array/string lengthkeys- Object keysvalues- Object valuesmap(expr)- Transform eachselect(cond)- Filter
đĻ Construction
{a, b}- Object from fields[.foo, .bar]- Array| pipe- Pipe operationsfirst- First elementlast- Last element
jq Playground Guide
jq is the standard command-line tool for slicing, filtering, and transforming JSON â used everywhere from shell pipelines (curl ... | jq '.data[]') to CI scripts. This playground implements a practical subset of jq syntax entirely in your browser, so you can prototype an expression against real data before dropping it into a script, without installing anything or piping data through a terminal.
Start simple: . returns the whole document, .users[0].name drills into a specific field, and .users | map(.name) pipes an array through a transformation. Combine select() with a condition to filter â for example .items[] | select(.price > 100) â and use {name, id} shorthand to reshape objects down to just the fields you need.
Frequently Asked Questions
Does this support every jq feature?
No â this covers the operations most people reach for daily (field/array access, map, select, length, keys/values, object/array construction, and pipes). Advanced jq features like custom function definitions, reduce, and regex builtins aren't implemented; for those, use the real jq CLI.
How do I filter an array of objects?
Pipe the array through select() with a comparison, e.g. .products[] | select(.inStock == true) â this evaluates the condition against every element and keeps only the ones that match.
What's the difference between jq, JSONPath, and JMESPath?
All three query JSON, but jq reads like a small pipeline language (great for chaining transforms), JSONPath uses a compact $.a.b[0] path syntax popular in JavaScript tooling, and JMESPath is the query language behind the AWS CLI's --query flag. Try all three in this site's playgrounds to see which reads more naturally for your use case.
Common jq recipes
jq is the standard command-line tool for slicing JSON in shells and CI scripts. A handful of patterns covers most daily needs, and this playground is a safe place to try them before putting them in a script.
Tips and common pitfalls
.items[] | {id, name}reshapes each item to just the fields you need.map(select(.active))keeps only matching elements while preserving the array.[.[] | .price] | addsums a field across all elements.- On the command line,
jq -rprints raw strings without quotes, which is ideal for passing values to other commands.
More questions
How do I use jq with curl?
Pipe the response into it: curl -s https://api.example.com/users | jq ".[0].name".
Why does my filter return several outputs instead of an array?
The .[] operator emits each element separately. Wrap the expression in square brackets, [ ... ], to collect the results into one array.