jq README

The project's README from github.com/jqlang/jq. As one markdown file: README.md.

jq

jq is a lightweight and flexible command-line JSON processor akin to sed,awk,grep, and friends for JSON data. It's written in portable C and has zero runtime dependencies, allowing you to easily slice, filter, map, and transform structured data.

Documentation

Installation

Prebuilt Binaries

Download the latest releases from the GitHub release page.

Docker Image

Pull the jq image to start quickly with Docker.

Run with Docker

Example: Extracting the version from a package.json file
docker run --rm -i ghcr.io/jqlang/jq:latest < package.json '.version'
Example: Extracting the version from a package.json file with a mounted volume
docker run --rm -i -v "$PWD:$PWD" -w "$PWD" ghcr.io/jqlang/jq:latest '.version' package.json

Building from source

Dependencies

Instructions

git submodule update --init    # if building from git to get oniguruma
autoreconf -i                  # if building from git
./configure --with-oniguruma=builtin
make clean                     # if upgrading from a version previously built from source
make -j8
make check
sudo make install

Build a statically linked version:

make LDFLAGS=-all-static

If you're not using the latest git version but instead building a released tarball (available on the release page), skip the autoreconf step, and flex or bison won't be needed.

Cross-Compilation

For details on cross-compilation, check out the GitHub Actions file and the cross-compilation wiki page.

Community & Support

License

jq is released under the MIT License. jq's documentation is licensed under the Creative Commons CC BY 3.0. jq uses parts of the open source C library "decNumber", which is distributed under ICU License

jq (jqlang/jq)

Searching Database…

35.8K ·GitHub
这是干什么的?jq 是一个轻量级的命令行 JSON 处理工具,就像 sed、awk 和 grep 一样,只不过专门针对 JSON 数据:它可以在终端里直接对结构化数据进行切片、过滤、映射和转换。
那它是一个我直接运行的独立工具,还是一个要导入到我代码里的库?它是一个独立的命令行工具,不是库。它用可移植的 C 语言编写,没有任何运行时依赖,拿来处理任何 JSON 都行。
我怎么把它装上?可以从 GitHub releases 页面下载预编译的二进制文件,也可以拉取 jq 的 Docker 镜像,或者按常规的 autotools 流程从源码构建(autoreconf、configure、make)。
要让它跑起来,我还需要装别的东西吗?运行时什么都不需要——二进制文件没有任何依赖。不过从源码构建的话,需要 libtool、make、automake 和 autoconf。
从源码构建时有什么坑吗?有一个:如果你构建的是已发布的 tarball 而不是最新的 git 版本,就跳过 autoreconf 这一步——而且也不需要 flex 或 bison。
它能在哪些平台上运行?Linux、macOS 和 Windows 都可以,发布页面上有预编译的二进制文件。也提供 Docker 镜像,针对其他平台的交叉编译也有文档说明。
我能不装任何东西就先试用 jq 吗?可以——play.jqlang.org 是官方的在线试玩环境,完整文档则在 jqlang.org 上。
这个项目还在积极维护吗?是的——GitHub 发布页面会持续更新版本,仓库上运行着 CI 工作流,而且 Discord 和 Stack Overflow 的 jq 标签下还有一个活跃的社区。
What are similar projects?fq, fx, fastfetch, miller, difftastic, mas, cloc, tig
Creator
jqlang
Size
8 MB
Stars
35.8K
Age
14y
Commits · 90 Days