मुख्य सामग्री पर जाएँ
kitlocal.dev

jq चीटशीट

लोकल चलता है

100% आपके ब्राउज़र में प्रोसेस होता है। इनपुट और आउटपुट कभी आपके डिवाइस से बाहर नहीं जाते।

jq 1.8 के विरुद्ध सत्यापित jq JSON प्रोसेसर फ़िल्टर, पाइप, ऑब्जेक्ट निर्माण, ऐरे, select, map, group_by, reduce और CLI फ़्लैग।

यह कैसे काम करता है

Every jq filter transforms an input JSON stream into zero or more output JSON values. Dot (`.`) is the identity filter; pipes (`|`) pass each output of the left filter into the right filter, and `.[]` explodes an array or object into a stream of items so you can filter, map and re-wrap them with `[...]`.

सर्वाइवल किट

वे कुछ कमांड जिन्हें सबसे पहले सीखना चाहिए।

40 कमांड

कीबोर्ड शॉर्टकट/खोज पर फ़ोकस करेंJKचयन आगे-पीछे करेंCचयनित कॉपी करेंFचयनित बुकमार्क करेंEscखोज साफ़ करें

Inspect & format JSON

Start with `.` to validate and pretty-print JSON, or `-r`/`-c` to adapt formatting for downstream tools.

आधिकारिक दस्तावेज़: Invoking jq
  • आवश्यक

    Validate and pretty-print JSON with syntax highlighting.

    jq . <file.json>

    इसका उपयोग कब करें

    Quickly format minified API responses or confirm JSON syntax from the terminal.

    घटक विवरण

    .
    identity filter: passes the whole JSON value unchanged

    उदाहरण

    echo '{"b":2,"a":1}' | jq -c .

    परिणाम

    {"b":2,"a":1}

    यह भी काम करता है

    • jq -S . <file.json> (sort object keys alphabetically)

    यह भी देखें

Access fields & arrays

Chain property names with `.a.b`, index arrays with `.[0]`, and append `?` to skip missing/null errors.

आधिकारिक दस्तावेज़: Basic filters

Filter & transform

Combine `select(cond)` to drop items and `map(...)` or `[...]` to transform the remaining ones.

आधिकारिक दस्तावेज़: Builtin operators & functions

Sort, group & aggregate

Group records by a key, deduplicate, compute totals, or flatten nested arrays.

आधिकारिक दस्तावेज़: Sorting and grouping

CLI variables, CSV & shell interop

Pass shell parameters safely with `--arg` / `--argjson` and export tables directly with `@csv` or `@tsv`.

आधिकारिक दस्तावेज़: Format strings and escaping

इसे KitLocal टूल में आज़माएँ

शब्दावली
Filter
An expression in jq that takes a JSON value and outputs zero or more values.
Stream
Multiple values produced by `.[]` or `,` before wrapping back into an array with `[...]`.
Raw output (-r)
Outputs strings without JSON surrounding quotes — essential when feeding bash or grep.
Compact (-c)
Prints each JSON object on a single line (NDJSON / JSON Lines).

15 नव॰ 2026 को जाँचा गया · वर्शन jq 1.8 के विरुद्ध जाँचा गया

स्रोत: jq Manual (jqlang.org)

कोण कोष्ठक में दी गई किसी भी चीज़ को अपने मानों से बदलें। कमांड आधिकारिक दस्तावेज़ों से लिए गए हैं, और उदाहरण दिखाए गए वर्शन पर चलाए गए थे।