Skip to content

jq Playground

Runs jq 1.7 filters against pasted JSON in the browser with a cheatsheet, and hands you the matching command line.

Runs jq filters against a document in the browser — a real interpreter for the jq 1.7 grammar rather than a few string operations, so pipes, `reduce`, `def`, destructuring and the update operators all behave as they do on the command line. The equivalent shell command is printed under the filter.

🔒 Runs entirely in your browserjqjsonqueryplayground

Filter

jq '.orders[] | select(.status == "shipped") | {id, customer}' data.json

Input JSON

Drop a .json file

Read in this tab only. Nothing is uploaded.

1 output

Outputs

1

Time

3 ms

Types

object

An interpreter for jq 1.7 grammar, written here. It supports paths (.a[0].b, .., ?), |·,·//, arithmetic, comparison, and/or/not, string interpolation, if, try, reduce, foreach, as (destructuring included), def, updates like |=·+=, formats such as @base64·@csv, and the 180 builtins below. The tests are the jq manual’s own examples.

Not supported: input·inputs (there is only one document), $ENV·env (empty), label·break, --stream, nested arrays in @sh, formats other than ISO 8601 in strptime, getpath stream mode, and modules (import). Regular expressions run on the browser’s engine rather than jq’s Oniguruma, so \p{L} and named groups work, and there may be subtle differences around lookbehind.

If all you want is one path, the JSONPath tester may be simpler.

How to use it

  1. Paste the document

    One JSON value, or several in a row — the tool reads them as a jq input stream, and the count is shown in the panel title.

  2. Write the filter, or take one from the row of examples

    The buttons cover the shapes that come up: select, map, group_by, string interpolation, reduce, and the update operators. Hovering one says what it does.

  3. Set the flags you would use on the command line

    `-c` for one line per output, `-S` to sort keys, `-r` for strings without quotes, `-s` to slurp several inputs into one array. The command line at the bottom updates with them.

  4. Copy the command, not just the output

    The generated `jq …` line is properly quoted for a POSIX shell, so it can go straight into a script or a pipeline.

Common questions

Is this really jq?

It is an independent interpreter for jq’s grammar, tested against the examples in jq’s own manual. That covers the language and the common builtins; it is not a compile of jq itself, so anything depending on jq’s C internals will differ.

Why does `input` not work?

Because there is one document here, not a stream a filter can pull more from. `input`, `inputs`, `$ENV`, `env`, `label`/`break`, `--stream` and modules are all listed as unsupported on the page rather than failing mysteriously.

My regular expression behaves differently from jq’s.

jq uses Oniguruma; this uses the browser’s engine. In practice `\p{L}` and named groups work in both, and the differences show up around lookbehind and a few character-class escapes. If a pattern matters, test it on the machine that will run it.

It stopped at 5,000 outputs.

A deliberate limit, along with a step limit. `..` over a large document produces enormous output, and a filter with a runaway recursion would otherwise hang the tab. Narrow the filter, or run it on the command line where you can pipe to `head`.

Feed it from

Next

These accept what this tool produces, so the result can go straight in.