b2KIT

jq Playground

Run jq filter expressions against JSON data in the browser with syntax highlighting.

Tested tool guide Tested browser tools Checked August 16, 2026

What jq Playground does, with a checked example

Paste JSON into jq Playground, enter a jq filter, and inspect each value that the filter emits. It supports jq field selection, pipes, array and object construction, filtering, and calculations, with syntax highlighting for the expression. Evaluation happens locally in the browser, so pasted data is not uploaded. The main source of confusion is jq's stream model: `.items[]` emits one output value per item, while `[.items[]]` collects those values into a single JSON array. That distinction determines whether the result is one JSON document or a sequence of values.

Worked example

A concrete input and expected output from the current implementation.

Input

JSON input:
{"items":[{"name":"pen","qty":4},{"name":"pad","qty":2}]}

Filter:
.items | map({name: .name, doubled: (.qty * 2)})

Expected output

[
  {
    "name": "pen",
    "doubled": 8
  },
  {
    "name": "pad",
    "doubled": 4
  }
]

`.items` selects the array, and `map` constructs one new object for each element. The calculated values are 4 times 2 = 8 and 2 times 2 = 4.

How the result is produced

1

Value flow

The JSON input becomes the initial `.` value. `.items` selects a member, `map(...)` evaluates its inner filter for every array element, and `|` sends each result from the left filter into the right filter. Brackets and braces construct new arrays and objects. Because a stage can emit multiple values, later stages may run more than once for one original input.

2

Results and errors

The output shows the JSON representation of values emitted by the filter. JSON strings remain quoted, while arrays and objects retain their JSON structure. Invalid input JSON, malformed filter syntax, and type-incompatible operations are errors. Accessing an absent object key is different: ordinary member access generally yields `null`, so a null result can indicate missing data rather than failed execution.

Good uses

  • Extract a few nested fields from a copied API response, then collect them into a smaller array for inspection.
  • Test a `map`, `select`, or object-construction expression on sample records before putting that filter in a jq command.
  • Reshape configuration JSON by renaming keys, dropping unwanted members, and deriving a new numeric or boolean field.

Limits and checks

  • Several displayed top-level values form a jq stream, not one array and not necessarily one valid JSON document.
  • Input must be JSON, not a JavaScript object literal; comments, single-quoted strings, bare keys, and trailing commas are invalid.
  • The result represents parsed values, so the input's indentation, whitespace, and textual formatting should not be expected to survive.

Common questions

Why does `.items[] | .name` not return an array?

The `[]` iterator emits each array element as a separate value, and `.name` then emits each corresponding name. Use `[.items[] | .name]` when you want those names collected into one array. For an existing array, `.items | map(.name)` expresses the same collection directly.

Can I paste a complete `jq -r` shell command with a filename?

No. Enter the jq filter expression and JSON data in their respective inputs. `-r` is a command-line output option, shell quoting is interpreted by a shell, and a filename tells command-line jq to open a file. This playground evaluates a filter against the JSON you supply; it does not reproduce shell parsing or file arguments.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools