jq Playground

Test jq Filters on JSON
online, free & instant

Query, filter, and extract data from JSON using jq-style expressions. Wildcards, recursive descent, array slicing, and conditional filters — all in your browser.

Open jq Playground

Filter JSON in three steps

Paste your JSON Drop any JSON document — API responses, config files, nested data — into the input area.
Write a filter expression Use JSONPath syntax like $.store.book[*].title or $.users[?(@.age>25)] to query your data.
Recursive descent Use .. to search at any depth — $..price finds every "price" field no matter how deeply nested.
Array slicing & wildcards Slice arrays with [0:5], select all elements with [*], and combine with filters for powerful queries.

No account. No upload. No nonsense.

🔒

No Server

Your JSON never leaves your device. There is no backend to send it to.

Zero Dependencies

Single self-contained HTML file. No frameworks, no CDN calls, nothing to break.

📡

Works Offline

Load once and use forever — even on a plane or without internet access.

Related JSON tools

JSONPath Evaluator Full JSONPath implementation with wildcards, filters, slices, and recursive descent.
JMESPath Evaluator Evaluate JMESPath expressions — the query language used by AWS CLI.
JSON Formatter Pretty-print JSON with syntax highlighting and a collapsible tree view.
JSON Diff Compare two JSON documents side by side and see exactly what changed.

Common questions answered

What is jq and how does this playground work?

jq is a command-line JSON processor. This online playground provides similar filtering capabilities using JSONPath syntax — you can query, filter, and extract data from JSON without installing anything.

What filter syntax does the playground support?

The playground supports JSONPath syntax including dot notation ($.store.book), wildcards ($..* and [*]), array slicing ([0:3]), recursive descent (..), and conditional filters (?(@.price<10)).

Can I filter JSON arrays by a condition?

Yes. Use filter expressions like $.store.book[?(@.price<10)] to select array elements matching a condition. Supports ==, !=, <, >, <=, >= comparisons.

How is JSONPath different from jq syntax?

jq uses pipe-based syntax (.store.book[] | select(.price<10)) while JSONPath uses path expressions ($.store.book[?(@.price<10)]). Both achieve similar results — this tool uses JSONPath, which is widely supported in APIs and tools.

Is my JSON data secure in the playground?

Yes. All filtering and querying happens in your browser — no data is ever sent to a server. The tool works fully offline after the first load.

What is jq?

jq is a command-line JSON processor for filtering, transforming, and formatting JSON in shell pipelines. Its syntax is concise: .users[] | select(.active) | .name extracts names of active users. jq is installed on many Linux distributions and is the standard for processing JSON in scripts and CI/CD pipelines.

This playground lets you test jq-style expressions in your browser without installing anything. jq supports object construction, array manipulation, conditionals, string interpolation, regular expressions, and user-defined functions. It is useful for ad-hoc data extraction from API responses, log files, and configuration dumps.

Filter and transform with jq
Input
// Data
{"users":[
  {"name":"Alice","active":true},
  {"name":"Bob","active":false},
  {"name":"Charlie","active":true}
]}

// Query: .users[] | select(.active) | .name
Output
"Alice"
"Charlie"

Get the most out of this tool

Ready to query your JSON?

Free forever. No signup. Instant results.

Open jq Playground now

Understanding jq — the JSON command-line processor

jq is a lightweight, flexible command-line tool for processing JSON data, written by Stephen Dolan and released in 2012. Often described as "sed for JSON", jq enables field extraction, filtering, transformation, and aggregation of JSON data directly in the terminal. Unlike general-purpose scripting languages, jq's filter language is specialized for JSON manipulation, making common operations like field extraction, array mapping, and conditional filtering expressible in compact one-liners.

The identity filter . is jq's simplest expression — it outputs the input unchanged but with pretty-printing applied. This makes jq '.' the most common use of jq: formatting minified JSON from curl output into readable indented format. Combined with curl, curl -s https://api.example.com/data | jq '.' is a staple command for inspecting API responses in the terminal.

Field access in jq uses dot notation: .name accesses the name field of the root object, and .user.email navigates two levels deep. Array indexing uses bracket notation: .[0] accesses the first element. The .[] iterator (without index) expands an array or object, outputting each element on a separate line — fundamental for processing JSONL streams where each input is one array element.

The pipe operator | chains transformations. .users | .[] | .name takes the users array, iterates over its elements, and extracts each element's name field. This pipeline model allows complex transformations to be composed from simple, understandable steps. The select function select(condition) filters to elements matching a condition: .[] | select(.active == true) outputs only active elements.

jq's map() function transforms every element of an array. map(.price * .quantity) multiplies price by quantity for every element in an array. map(select(.status == "active")) is equivalent to filtering with select but preserves the array wrapper. map({name: .name, total: (.price * .quantity)}) creates new objects by projecting and computing fields from each element.

Aggregation with jq uses built-in functions like add, length, min, max, unique, and group_by. [.[] | .price] | add sums all prices in an array. group_by(.category) | map({category: .[0].category, count: length}) groups by category and counts items in each group. These patterns enable data analysis operations without leaving the terminal or writing a Python script.

JSONL (newline-delimited JSON) processing is a jq specialty. The --slurp (-s) flag collects all input lines into one array before applying the filter — useful for cross-record operations. Without --slurp, jq applies the filter to each input line independently — useful for per-record transformations. The --raw-output (-r) flag outputs string values without JSON double-quote wrapping, making extracted values usable directly in shell scripts.

Real-world uses for jq

API response processing in shell scripts Shell scripts that call APIs with curl pipe the response through jq to extract specific values for use in subsequent commands. TOKEN=$(curl -s /auth | jq -r '.token') extracts an authentication token string that can be used directly in variable assignment without JSON parsing code.
Log analysis and monitoring Structured JSON logs can be filtered and analyzed with jq. cat app.log | jq 'select(.level == "ERROR") | .message' extracts error messages from a structured log file. Combining jq with sort | uniq -c | sort -rn produces frequency counts of error types without custom tooling.
Kubernetes and cloud CLI output processing Kubernetes kubectl get pods -o json | jq '.items[] | {name: .metadata.name, status: .status.phase}' extracts pod names and statuses from verbose API output. Combined with shell loops, jq filters enable complex cluster automation without custom tooling or SDK code.
Data transformation in CI/CD pipelines CI/CD pipelines use jq to transform build artifacts, test results, and deployment manifests. Extracting deployment URLs from Terraform output, parsing test coverage reports, and transforming one JSON format to another are common jq applications in automated pipeline steps.

jq usage pitfalls

Additional frequently asked questions

How do I install jq on my system?

On macOS, install with Homebrew: brew install jq. On Ubuntu/Debian Linux: sudo apt-get install jq. On Windows, use Chocolatey (choco install jq), Winget (winget install jqlang.jq), or download the binary from jqlang.github.io/jq. jq is a single binary with no runtime dependencies — download the binary directly and place it in your PATH for immediate use.

What is the difference between jq and JSONPath?

jq is a full-featured command-line data transformation language with functions, variables, conditionals, and reduce/foreach operations. JSONPath is a query language focused on selecting values by path expression. jq can transform data into entirely new shapes; JSONPath primarily extracts existing values. For simple field extraction, both work well. For data transformation and aggregation, jq is significantly more powerful.

Can jq handle invalid or malformed JSON?

No — jq requires valid JSON input. If the input contains syntax errors (trailing commas, single quotes, comments), jq will report a parse error and exit. Use a JSON repair tool to fix the JSON first, or use jq's --raw-input (-R) flag to treat each line as a raw string and then apply parsing with try fromjson to handle mixed-validity input.

How do I use jq in JavaScript without the command-line tool?

The jq-web package provides jq compiled to WebAssembly, enabling jq filter execution in the browser or Node.js. Alternatively, node-jq wraps the native jq binary for Node.js. For most JavaScript use cases, JSONPath libraries or native JavaScript array methods (filter, map, reduce) are more practical than running jq in a Node.js context.