← 返回
效率工具

jq

Command-line JSON processor. Extract, filter, transform JSON.
{"answer":"命令行JSON处理器,提取、过滤、转换JSON。"}
gumadeiras
效率工具 clawhub v1.2.0 1 版本 98895.5 Key: 无需
★ 4
Stars
📥 4,576
下载
💾 417
安装
1
版本
#latest

概述

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

版本历史

共 1 个版本

  • v1.2.0 当前
    2026-03-28 10:13 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

productivity

Nano Pdf

steipete
使用nano-pdf CLI通过自然语言指令编辑PDF
★ 274 📥 114,718
developer-tools

browsh

gumadeiras
现代文本浏览器,使用无头 Firefox 在终端渲染网页。
★ 8 📥 8,819
productivity

Weather

steipete
获取当前天气和预报(无需API密钥)
★ 444 📥 226,101