go-supertools
Developer & Data Tools

jq Playground

Run jq filters on JSON in your browser: the real jq engine, with examples, flags and a time limit.

Runs in your browser Your input never leaves your device.

jq 1.7. Your JSON and filter stay in this page.

Report a problem with this tool

About this tool

jq is the command-line tool many developers use to slice, filter and reshape JSON, with a small functional language: .name picks a field, .[] walks a list, map and select transform and filter it, group_by and add summarise it, and @csv or @tsv turn it into tables. This playground runs the real jq 1.7 engine, compiled to WebAssembly, in your browser, so a filter behaves as it would on the command line. We compared it with the native jq 1.7 program on more than 5,000 runs of about 200 filters, on many kinds of input and with the common flags, and the output matched except for one formatting detail: dates in the year 1 are printed with leading zeros here. Choose an example to start, paste your JSON and write a filter. The flags are the usual ones: -c for compact output, -r to print strings without quotes, -S to sort object keys, -s to read several JSON values into one array, -n to run with no input and -a for ASCII-only output. Several JSON values pasted one after another are read as separate inputs, as jq does. The engine runs in a separate thread with a ten second limit, so a filter that never ends can be stopped without freezing the page. Error messages are jq's own, with the position of the mistake. Your JSON and your filters are not uploaded. Some command-line features do not exist in a browser: reading files, environment variables, --arg options and modules are not available here. Newer jq features added after version 1.7, such as trim, toarray and abs, will report that they are not defined.

How to use it

  1. Choose an example or write your own filter, for example .items[] | select(.price > 10) | .name.
  2. Paste your JSON into the input box.
  3. Tick any flags you need, then press Run (or Ctrl+Enter in the filter box).
  4. Read the result, or the error message, and copy the result.

Common problems

It says a function is not defined
This playground uses jq 1.7. Functions added later (trim, ltrimstr variants, toarray, abs, have_decnum and others) are not there; use a combination of older functions such as sub or test.
I get a compile error with unexpected token
Check quotes and brackets in the filter. In jq, strings need double quotes, and use | to pass results from one step to the next.
It stopped after ten seconds
The filter may never end (for example repeat without limit) or the input is huge. Add limit(10; …) or reduce the input.
Only the first value is processed
Several JSON documents in a row are processed one by one. Tick Slurp (-s) if you want them in one array.
My JSON is rejected
jq needs valid JSON: double quotes around keys and strings, no trailing commas and no comments. Use the JSON validator to find the error.