DevTools Logo

jq Playground

jq Playground

Run common jq-style filters against JSON in your browser.

Runs in your browser
Try an example

JSON input

github · 21 lines · 256 chars

Output

exit 0
{
  "name": "devtools",
  "stargazers_count": 42,
  "license": {
    "spdx_id": "MIT"
  },
  "items": [
    {
      "name": "a",
      "price": 4
    },
    {
      "name": "b",
      "price": 12
    },
    {
      "name": "c",
      "price": 8
    }
  ]
}

Details

jq Playground gives you a JSON input pane, a filter editor and a result pane with stdout, stderr and an exit-code badge. Filters run locally through a zero-dependency evaluator covering field paths, array iteration, indexing, select, map, object and array construction, and the most common built-ins. --arg and --argjson style bindings, raw and compact output, slurp and null input are supported. Filters outside this subset produce an explicit error instead of a misleading approximation.

More examples

Filter cheap items

.items[] | select(.price < 10) | .name

Iterates the items array, keeps entries below ten and prints their names.

List all names

.items | map(.name)

Builds an array of names from the input array.

Build an object

{label: .name, count: (.items | length)}

Constructs a new object from fields of the sample.

Examples

Filter cheap items

Input
.items[] | select(.price < 10) | .name
Output
"a"
"c"

Each item is tested and only matching names are emitted.

Map names

Input
.items | map(.name)
Output
["a","b","c"]

map applies the filter to every array element and collects the results.

Unsupported built-in

Input
group_by(.price)
Output
jq: error: group_by/1 is not defined in this subset

Unsupported filters are reported rather than silently approximated.

About this tool

jq Playground is a fast loop for experimenting with jq-style JSON filters. Paste a payload, write a filter and read the result immediately with stdout, stderr and an exit-code badge. Nothing is uploaded; evaluation happens in the browser tab.

The evaluator covers the commonly used core: identity, dotted field paths, array iteration and indexing, select, map, keys, length, sort, unique, string and number literals, array and object construction, and simple comparisons. Common flags are exposed as controls: raw output, compact output, slurp and null input, plus --arg style name/value bindings.

Filters outside that subset fail loudly with a message naming the unsupported built-in. This is an intentional honesty boundary: the tool never produces a plausible-looking but incorrect result for advanced jq programs.

What this tool does not do

  • This is a zero-dependency filter subset, not the jq binary or its WASM build.
  • NDJSON streams, module imports, reduce, group_by and most advanced built-ins are unsupported.
  • Output is capped at 20 MB; a truncation notice is shown when the cap is hit.
  • There is no filter history or shareable URL in this version.
  • Validation parses a single JSON document before evaluation.

How to use this tool

  1. Load a sample

    Choose a bundled sample or paste your own JSON into the input pane.

  2. Write a filter

    Start with a field path such as .name, then add pipes, select or map as needed.

  3. Set flags and bindings

    Toggle raw or compact output, slurp or null input, and provide an optional --arg name and value.

  4. Read the result

    Inspect stdout, switch to stderr for errors, and copy or download the output.

Use cases

Learning filter syntax

Try paths, pipes and select statements without installing jq.

API response shaping

Prototype extraction filters against a realistic pasted response.

CI filter debugging

Check a filter's output and error message before putting it in a pipeline.

Supported filter forms

FormExample
Field path.user.address.city
Array iteration.items[] | select(.price < 10)
Index.items[0].name or .items[-1]
Built-inskeys, length, type, sort, unique, map, select, add
Construction{label: .name} and [.a, .b]
Bindings$wanted with an --arg name/value row

Advanced jq features such as group_by, reduce and module imports are intentionally unsupported.

Common mistakes

Mistake:Expecting the full jq language.

Fix:Use the supported forms table; advanced built-ins fail with an explicit error.

Mistake:Forgetting that raw output strips JSON quoting.

Fix:Leave -r off when you need valid JSON strings.

Mistake:Applying an array filter to a single object.

Fix:Use .[] to iterate arrays or object values first.

Mistake:Pasting NDJSON into the input pane.

Fix:This tool parses a single JSON document; split streams before pasting.

Mistake:Using --arg values as JSON.

Fix:Provide a bare string for --arg style bindings; numeric JSON values come from --argjson style rows where supported.

Frequently asked questions

Is this real jq or a clone?

It is a zero-dependency evaluator for the common jq filter subset, not the jq binary. Supported forms behave like jq for the cases shown in the tool; anything outside the subset produces an explicit error rather than a guess. Use the installed jq binary when you need the full language.

Which filters are supported?

Field paths, array iteration and indexing, pipes, select with comparisons, map, keys, length, type, sort, reverse, unique, add, first, last, not, has, string and number literals, and array or object construction.

Are --arg and --argjson supported?

You can provide a name/value binding row that works like --arg for strings, and a JSON-valued row for numeric or structured bindings. Bindings are referenced as $name in the filter.

Can it handle multiple JSON documents?

No. The input pane parses one JSON document. Split NDJSON streams into single documents before pasting them.

Is my JSON uploaded?

No. Parsing, evaluation and output formatting all happen in your browser tab. Nothing is sent to a server.

What do the exit codes mean?

Zero means the filter produced output; three means a filter error such as an unsupported built-in; four means invalid JSON input or no output in raw mode. The stderr tab carries the full message.

References & standards