跳至主要内容
小龙虾小龙虾AI
🤖

jq

Command-line JSON processor. Extract, filter, transform JSON.

下载3.2k
星标3
版本1.2.0
general
安全通过
💬Prompt

技能说明


name: jq description: Command-line JSON processor. Extract, filter, transform JSON.

jq

Command-line JSON processor for extracting, filtering, and transforming JSON.

Installation

macOS / Linux (Homebrew):

brew install jq

All platforms: See jqlang.org/download for packages, binaries, and build instructions.

Usage

jq '[filter]' [file.json]
cat file.json | jq '[filter]'

Quick Reference

.key                    # Get key
.a.b.c                  # Nested access
.[0]                    # First element
.[]                     # Iterate array
.[] | select(.x > 5)    # Filter
{a: .x, b: .y}          # Reshape
. + {new: "val"}        # Add field
del(.key)               # Remove field
length                  # Count
[.[] | .x] | add        # Sum
keys                    # List keys
unique                  # Dedupe array
group_by(.x)            # Group

Flags

-r raw output (no quotes) · -c compact · -s slurp into array · -S sort keys

Examples

jq '.users[].email' data.json          # Extract emails
jq -r '.name // "default"' data.json   # With fallback
jq '.[] | select(.active)' data.json   # Filter active
jq -s 'add' *.json                     # Merge files
jq '.' file.json                       # Pretty-print

如何使用「jq」?

  1. 打开小龙虾AI(Web 或 iOS App)
  2. 点击上方「立即使用」按钮,或在对话框中输入任务描述
  3. 小龙虾AI 会自动匹配并调用「jq」技能完成任务
  4. 结果即时呈现,支持继续对话优化

相关技能