jq: filter and reshape JSON from the command line
Note, . Status: reviewed. Tags: ai, agents, research. Authorship: synthesis by iinventedlight from the cited sources; text drafted with AI assistance (Grok Bot), reviewed by Cole Withington on 2026-11-02.
jq: filter and reshape JSON from the command line
Summary
jq reads JSON on stdin or from files and applies a filter. Use -r for raw strings and -e to make the exit status reflect whether the result is null/false. Read-only by default; it never edits files in place.
Draft. License: CC0 1.0. Sources: [S1] jq project, "jq Manual"; [S2] Grok Bot box, "Grok Bot box run: jq --version".
Agent access
- CLI: yes (
jq, tested jq-1.7 on the Grok Bot box). MCP connector: none needed. API: none. - Best route: CLI.
- Permissions: read access to the input; no network.
Facts
- id: F1 claim: jq takes a filter expression and input JSON, and prints the result as JSON. confidence: high date: 2026-11-02 sources: [S1, S2] license: CC0 1.0 checked_on: 2026-11-02
- id: F2 claim:
.a[] | select(.v>1) | .niterates an array, keeps matching objects and extracts one field; tested on jq-1.7. confidence: medium date: 2026-11-02 sources: [S2] license: CC0 1.0 checked_on: 2026-11-02 - id: F3 claim:
-rprints strings without JSON quotes, which is the usual choice when piping into other shell tools. confidence: high date: 2026-11-02 sources: [S1, S2] license: CC0 1.0 checked_on: 2026-11-02 - id: F4 claim:
-cprints compact one-line JSON, handy for logs and line-based tools. confidence: high date: 2026-11-02 sources: [S1, S2] license: CC0 1.0 checked_on: 2026-11-02 - id: F5 claim: With
-e, jq exits 1 when the last output is null or false; observed exit 1 for a missing key. confidence: high date: 2026-11-02 sources: [S1, S2] license: CC0 1.0 checked_on: 2026-11-02 - id: F6 claim: jq does not modify the input file; write to a new file and rename it if you need an in-place change. confidence: medium date: 2026-11-02 sources: [S1] license: CC0 1.0 checked_on: 2026-11-02
Cite this
iinventedlight. 2026. "jq: filter and reshape JSON from the command line." iinventedlight Library, iil:note:7zd4xmb9, version of 2026-11-02. https://iinventedlight.com/library/notes/cli-jq-json/. License: CC0-1.0.
@misc{iil_note_7zd4xmb9,
author = {{iinventedlight}},
title = {{jq: filter and reshape JSON from the command line}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-02},
url = {https://iinventedlight.com/library/notes/cli-jq-json/},
note = {Permanent ID iil:note:7zd4xmb9. License: CC0-1.0.},
}
For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/cli-jq-json.md.