jq playground
The jq tab of the query bar runs jq, a language for picking out and reshaping JSON. Use it to build a new value from the document, for example a list of names, a count per status, or an object with renamed fields. The output appears under the query bar, and you can copy it or open it as a new document.
jq works on JSON and NDJSON files.
Run a jq query
Section titled “Run a jq query”-
Press Ctrl+J, or choose Search → jq Query…. The query bar opens on the jq tab.
-
Type a query, for example:
.orders[] | select(.status == "pending") | {id, total} -
Press Enter.
Each value the query outputs is one row in the list under the query bar, and the query bar shows how many there are, for example 12 values. Hover over a row to see it in full. If the query has a mistake, the query bar shows Error; hover over it to read what is wrong.
To run the query as you type, select Live preview (the lightning button): the output updates a moment after you stop typing. Live preview is off by default and applies to the current tab.
On an NDJSON file, the query runs once for each record: . is one record, so .status outputs the status of every record. Lines that are not valid JSON are skipped.
Use the output
Section titled “Use the output”- Copy output as JSON: copies the output. Several values are copied as one array.
- Open output in a new tab: opens the output as a new document, where you can browse, search, and save it. One value opens as itself; several open as an array.
To save the output to a file, open it in a new tab, then press Ctrl+Shift+S (Save As…).
For the other controls of the query bar, such as history and the syntax reference, see Use the query bar.
Large documents
Section titled “Large documents”On a JSON file, jq loads the document into memory, so a very large file fails with “Subtree too large to query in memory”. On such a file, use SQL or a filter query instead. On an NDJSON file, jq reads one record at a time, so the file’s size does not matter. See Limits.
For what JSON Digger’s jq supports, see jq in the query syntax reference.