A jq online playground that runs the real jq
This jq online playground runs jq 1.8.2 itself, compiled to WebAssembly, on the JSON you paste. It is not a look-alike: filters, functions, regular expressions, reduce, path expressions and error messages behave exactly as they do in the command-line tool, because it is the same program. Write a filter, press Run and read the output beside your input.
It is aimed at the moments when you are building a jq command for a shell script, a CI job or an API response, or learning jq from the manual. The example list contains filters from the jq 1.8 manual, and every one of them is checked against the output the manual documents. When the filter does what you want, Copy command gives you the matching jq line with the flags you ticked.
jq is downloaded once, about 1 MB, and runs in a background thread in your browser. Your JSON and filters are never uploaded.
How to use the jq Playground
- Paste your JSON into JSON input, or choose an example to load a filter with matching input.
- Type a jq filter, for example
.items[] | select(.price > 10) | .name. - Press Run (or Ctrl + Enter). The first run loads jq; after that, changes re-run the filter automatically.
- Choose the output format and tick options: raw strings (
-r), sorted keys (-S), slurp (-s) or null input (-n). Add variables withname=valueorname:=JSON. - Use Copy command to take the filter and flags to your terminal, and Stop if a filter never finishes.
jq Playground features
The real jq 1.8.2
The wasm build is the upstream jq, so syntax and edge cases match the command line.
Manual examples
Nineteen filters from the jq manual, each with its documented output verified by this page’s self-check.
Command-line options
Compact, tab and 4-space output, raw output, sorted keys, slurp, null input, --arg and --argjson.
Real error messages
Syntax errors and runtime errors are shown as jq reports them, together with the exit code (3 for a compile error, 5 for a runtime error).
Stop button
jq runs in a worker; Stop ends an infinite loop without freezing the page, and the engine restarts on the next run.
jq filters you will use most
The full language is documented in the jq 1.8 manual.
| Goal | Filter |
|---|---|
| Every element of an array | .[] |
| A field, with no error if the value is not an object | .name? |
| Keep matching items | map(select(.age >= 18)) |
| Build a new object | {name, city: .address.city} |
| Count items | length |
| Group and count | group_by(.type) | map({type: .[0].type, n: length}) |
Rows to CSV (with -r) | .[] | [.name, .age] | @csv |
| Use a variable | map(select(.age > $min)) with min:=10 |
Differences from the command line
- The input is the text box, so file arguments,
input_filenameand reading files do not apply. Module imports and$ENVare not available. - Only the options listed on the page are exposed. Use the copied command for anything else, such as
--streamor--seq. - The page shows jq’s output as text. If the output is not JSON (for example with
-r), it is shown unchanged. - To look for a value by path instead of writing a filter, try the JSONPath Tester; to tidy input first, use the JSON Formatter.
Library and licence
The page loads jq-wasm 3.0.0-jq-1.8.2 (MIT licence, by Owen Ou) from the jsDelivr CDN. It bundles jq 1.8.2 (MIT licence, copyright Stephen Dolan and the jq contributors). Nothing is modified.
jq Playground FAQ
How do I use jq online?
Paste JSON into the input box, type a filter such as .items[].name and press Run. The output appears on the right. The first run downloads jq, about 1 MB.
Is this the real jq or a JavaScript imitation?
It is the real jq 1.8.2 compiled to WebAssembly, so results and error messages match the command-line tool.
Why does jq say "Cannot index array with string"?
The filter tried to read a field from an array. Add .[] or map(…) to go through the elements first, or use .field? to skip values that are not objects.
Can I print plain text instead of JSON strings?
Tick “Raw strings (-r)”. Strings are printed without quotes, which is what you want for @csv, @tsv or join output.
How do I pass a variable into a filter?
Open Variables and add min:=10 (JSON) or label=orders (string), then use $min or $label in the filter.
Is my JSON sent anywhere?
No. jq runs inside your browser; only the jq engine file is downloaded from a CDN.