{ "name": "jq", "section": 1, "title": "command-line JSON processor (jq language subset)", "synopsis": [ "jq [-n] [-R] [-s] [-c] [-r] [-e] [-f file] filter [file...]", "jq reads JSON (concatenated values or NDJSON-style streams) from files or stdin." ], "description": "Runs a jq filter program against JSON values. The engine is vendored jqjs (pure JavaScript), not the C implementation at https://github.com/jqlang/jq — language coverage and edge cases differ.", "options": [ { "flag": "-n, --null-input", "meaning": "Use null as the sole input (ignore file/stdin for input)" }, { "flag": "-R, --raw-input", "meaning": "Treat each line as a string instead of JSON" }, { "flag": "-s, --slurp", "meaning": "Read all inputs into one array; run the filter once" }, { "flag": "-c, --compact-output", "meaning": "Compact JSON on output" }, { "flag": "-r, --raw-output", "meaning": "Print strings without JSON quotes" }, { "flag": "-e, --exit-status", "meaning": "Set exit status from outputs (no output → 4; last false/null → 1)" }, { "flag": "-f, --from-file", "meaning": "Read filter program from file" } ], "keywords": ["jq", "json", "query", "filter", "jqjs"], "seeAlso": [ { "name": "grep", "section": 1 }, { "name": "awk", "section": 1 } ], "bareOsNotes": "Engine: lib/jq-engine.js from @sscots/jqjs (mwh/jqjs). Missing vs C jq: try/catch, user-defined functions, recurse, many builtins, modules, full Unicode. See upstream jqjs README for the feature matrix.", "examples": [ { "caption": "pretty-print", "code": "jq . data.json" }, { "caption": "field", "code": "jq .version package.json" }, { "caption": "slurp array", "code": "jq -s 'map(.x) | add' parts.jsonl" }, { "caption": "compact", "code": "jq -c '.[] | select(.ok)' items.json" } ] }