मुख्य सामग्री पर जाएँ
Skillpedia
एनालिसिस और स्प्रेडशीट29k · #9767

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 पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/charmbracelet/crush/blob/main/internal/skills/builtin/jq/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

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_unsorted and -S are 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-output but 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 try to suppress errors on missing keys: jq 'try .foo.bar'
  • Use // "default" for fallback values: jq '.name // "unknown"'
  • Use @csv, @tsv, @base64, @html, @uri for 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

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills