jq-json-processor

Process, filter, and transform JSON data using jq - the lightweight and flexible command-line JSON processor.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "jq-json-processor" with this command: npx skills add arnarsson/jq-json-processor

jq JSON Processor

Process, filter, and transform JSON data with jq.

Quick Examples

Basic filtering

# Extract a field
echo '{"name":"Alice","age":30}' | jq '.name'
# Output: "Alice"

# Multiple fields
echo '{"name":"Alice","age":30}' | jq '{name: .name, age: .age}'

# Array indexing
echo '[1,2,3,4,5]' | jq '.[2]'
# Output: 3

Working with arrays

# Map over array
echo '[{"name":"Alice"},{"name":"Bob"}]' | jq '.[].name'
# Output: "Alice" "Bob"

# Filter array
echo '[1,2,3,4,5]' | jq 'map(select(. > 2))'
# Output: [3,4,5]

# Length
echo '[1,2,3]' | jq 'length'
# Output: 3

Common operations

# Pretty print JSON
cat file.json | jq '.'

# Compact output
cat file.json | jq -c '.'

# Raw output (no quotes)
echo '{"name":"Alice"}' | jq -r '.name'
# Output: Alice

# Sort keys
echo '{"z":1,"a":2}' | jq -S '.'

Advanced filtering

# Select with conditions
jq '[.[] | select(.age > 25)]' people.json

# Group by
jq 'group_by(.category)' items.json

# Reduce
echo '[1,2,3,4,5]' | jq 'reduce .[] as $item (0; . + $item)'
# Output: 15

Working with files

# Read from file
jq '.users[0].name' users.json

# Multiple files
jq -s '.[0] * .[1]' file1.json file2.json

# Modify and save
jq '.version = "2.0"' package.json > package.json.tmp && mv package.json.tmp package.json

Common Use Cases

Extract specific fields from API response:

curl -s https://api.github.com/users/octocat | jq '{name: .name, repos: .public_repos, followers: .followers}'

Convert CSV-like data:

jq -r '.[] | [.name, .email, .age] | @csv' users.json

Debug API responses:

curl -s https://api.example.com/data | jq '.'

Tips

  • Use -r for raw string output (removes quotes)
  • Use -c for compact output (single line)
  • Use -S to sort object keys
  • Use --arg name value to pass variables
  • Pipe multiple jq operations: jq '.a' | jq '.b'

Documentation

Full manual: https://jqlang.github.io/jq/manual/ Interactive tutorial: https://jqplay.org/

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Openclaw Video Editor

Pro-Studio v4.0.0. AI-powered background removal, smart subtitle placement, and cinematic LUT presets. The ultimate production suite for high-end video content.

Registry SourceRecently Updated
General

IOC 智能巡检报告

为 IOC(智能运营中心)生成智能巡检报告。自动分析设备状态、报警记录、能耗数据,生成专业的巡检日报/周报。支持连接 PostgreSQL 数据库读取实时数据,输出 Markdown/HTML 报告。适用于物业管理、商业综合体、工业园区等场景。

Registry SourceRecently Updated
General

Expert Library Plus Skill

Install and manage Expert Library Plus - the world's first AI expert library with name-based quality anchors. Enhances 43+ professional experts with historic...

Registry SourceRecently Updated
General

Api Gateway 1.0.46

Connect to 100+ APIs (Google Workspace, Microsoft 365, Notion, Slack, Airtable, HubSpot, etc.) with managed OAuth. Use this skill when users want to interact...

Registry SourceRecently Updated