jq
यह क्या करती है
यह स्किल JSON डेटा से जानकारी निकालने, छानने और उसका ढांचा बदलने में मदद करती है। यह उन लोगों के लिए है जो API जवाब, कॉन्फ़िग फ़ाइलों या लॉग के साथ काम करते हैं और उनमें से कोई एक जानकारी चाहते हैं।
कब इस्तेमाल करें
- ✓जब आपको JSON जवाब से एक फ़ील्ड या छनी हुई सूची निकालनी हो।
- ✓जब आप JSON डेटा को किसी दूसरे ढांचे में बदलना चाहें।
- ✓जब आप JSON में कॉन्फ़िग फ़ाइल या लॉग पढ़ रहे हों और जल्दी जवाब चाहिए।
Skill का लिंक
https://github.com/charmbracelet/crush/blob/main/internal/skills/builtin/jq/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस API जवाब से सभी सक्रिय यूज़र के नाम और ईमेल पते सिर्फ़ एक सूची के रूप में दीजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट एक jq फ़िल्टर लिखता है, जो JSON को चुनता, छानता या दोबारा बनाता है, और नतीजा लौटाता है। अंतर्निहित jq कॉमन फ़्लैग जैसे raw आउटपुट और compact आउटपुट समर्थित करता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
jq — Built-in JSON Processor
Crush ships a built-in jq command (via github.com/itchyny/gojq) available
in the bash tool. No external binary is required.
Supported Flags
| Flag | Description |
|---|---|
-r, --raw-output |
Output strings without quotes |
-j, --join-output |
Like -r but no trailing newline |
-c, --compact-output |
One-line JSON output |
-s, --slurp |
Read all inputs into an array |
-n, --null-input |
Use null as input (ignore stdin) |
-e, --exit-status |
Exit 1 if last output is false or null |
-R, --raw-input |
Read each line as a string, not JSON |
--arg name value |
Bind $name to a string value |
--argjson name value |
Bind $name to a parsed JSON value |
File arguments after the filter are also supported: jq '.foo' file.json.
Differences from Standard jq
The built-in uses gojq, which is a pure-Go jq implementation. Key differences:
- No object key ordering — keys are sorted by default;
keys_unsortedand-Sare unavailable. - Arbitrary-precision integers — large integers keep full precision (addition, subtraction, multiplication, modulo, division when divisible).
- String indexing —
"abcde"[2]returns"c". - Not supported —
--ascii-output,--seq,--stream,--stream-errors,-f/--from-file,--slurpfile,--rawfile,--args,--jsonargs,input_line_number,$__loc__, some regex features (backreferences, look-around). - YAML — gojq supports
--yaml-input/--yaml-outputbut the built-in does not currently expose these flags.
Common Patterns
Extract a field:
echo '{"name":"crush"}' | jq '.name'
Filter an array:
echo '[1,2,3,4,5]' | jq '[.[] | select(. > 3)]'
Reshape objects:
echo '{"first":"Ada","last":"Lovelace"}' | jq '{full: (.first + " " + .last)}'
Use variables:
echo '{}' | jq --arg host localhost --argjson port 8080 '{host: $host, port: $port}'
Slurp multiple JSON values:
echo '{"a":1}{"b":2}' | jq -s '.'
Compact output for piping:
echo '{"a":1}' | jq -c '.a += 1'
Raw string output:
echo '["one","two","three"]' | jq -r '.[]'
Process a file:
jq '.dependencies | keys' package.json
Null input for constructing JSON:
jq -n --arg msg hello '{"message": $msg}'
Tips
- Pipe jq output to other commands:
jq -r '.url' data.json | xargs curl - Chain filters with
|inside the expression, not shell pipes. - Use
tryto suppress errors on missing keys:jq 'try .foo.bar' - Use
// "default"for fallback values:jq '.name // "unknown"' - Use
@csv,@tsv,@base64,@html,@urifor format strings.
अक्सर पूछे जाने वाले सवाल
क्या मुझे jq अलग से इंस्टॉल करना होगा?
नहीं। jq कमांड अंतर्निहित है और किसी बाहरी प्रोग्राम की ज़रूरत नहीं है।
क्या यह बिल्कुल मानक jq जैसा काम करता है?
ज़्यादातर हाँ, लेकिन ऑब्जेक्ट की कुंजियाँ डिफ़ॉल्ट रूप से क्रम में होती हैं, और कुछ मानक फ़्लैग उपलब्ध नहीं हैं।
क्या यह पाइप किए डेटा के साथ फ़ाइलें भी पढ़ सकती है?
हाँ। फ़िल्टर के बाद आप फ़ाइल का नाम दे सकते हैं।
जानकारी
लेखक का मूल विवरण
Use when the user needs to query, filter, reshape, extract, create, or construct JSON data — including API responses, config files, log output, or any structured data — or when helping the user write or debug JSON transformations.
repo: charmbracelet/crush
लोकप्रियता
- GitHub स्टार
- 29k
- रैंकिंग में स्थान
- #9767
- लाइसेंस
- —
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
crush-config
29kयह आपके एजेंट को Crush सेट करने में मदद करती है, उसकी crushrc या crush.json कॉन्फ़िग फ़ाइल लिखकर, जिसमें प्रोवाइडर, मॉडल, MCP सर्वर, हुक और अनुमतियाँ शामिल हैं।
crush-hooks
29kयह आपके एजेंट को Crush के हुक लिखने और उनकी गड़बड़ी ठीक करने में मदद करती है, जो crush.json की सेटिंग से टूल कॉल चलने से पहले उन्हें जांचते, रोकते या बदलते हैं।
मिलती-जुलती skills
gitcrawl
394kयह आपके एजेंट को GitHub issues और pull requests के सेव आर्काइव में खोजने, मिलते-जुलते मामलों को समूह में रखने और लाइव स्थिति जांचने देती है।
slacrawl
394kयह आपके एजेंट को स्थानीय Slack आर्काइव में संदेश खोजने और गिनने, उसकी ताज़गी जांचने और ज़रूरत पड़ने पर उसे ताज़ा करने देती है।
goplaces
394kयह आपके एजेंट को Google Places से जगहें खोजने, उनका विवरण और समीक्षाएं पाने, और जगह के नाम हल करने में मदद करती है, स्क्रिप्ट के लिए JSON आउटपुट के साथ।