工具与资源stedolan.github.io编辑精选
jq:命令行 JSON 处理器
Jq – A Command-line JSON processor
2013 — 2015,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
jq 是一个命令行 JSON 处理器,用类表达式的语法对 JSON 数据进行过滤、切片和转换。它用可移植的 C 编写、零运行时依赖,是处理 API 响应和 JSON 数据的利器。
为什么经久不衰:它已成为命令行处理 JSON 的事实标准工具,与 httpie、AWS CLI 等搭配几乎是现代开发者的日常必备,多年后依然值得学习。
HN 评论精选
jq 虽优秀,但它的存在恰恰说明传统文本管道的局限,PowerShell 的对象管道是更好的思路
jq 很棒,是真正的成就。但它也暴露了传统 shell 的问题:jq 并非“只做一件事”的 Unix 工具,它实现了自己的表达式语言和内部管道。传统命令行工具受限于纯文本管道,无法传递结构化对象,而 PowerShell 的对象管道在这方面做得更好。
useerup查看英文原文
jq is awesome, a real achievement. At the same time it demonstrates everything that is wrong with traditional shells and what PowerShell gets so right. jq is not a "Unixy" tool in the sense that it should do one thing and do it right. jq implements its own expression language, command processor complete with internal "pipelines". Why would a tool need to do that? find is another utility that does many, many other things than to "find" items: It executes commands, deletes objects etc. Consider this challenge that included parsing json, filtering, projecting and csv-formatting output: https://news.ycombinator.com/item?id=9438109 Several solutions uses jq - to good effect. But the PowerShell solution uses PowerShell expressions to filter, sort and project items. The problem is - at the core - that the traditional command tools are severely restricted by only being able to rely on a text pipeline convention. You cannot parse json and send the "objects" along to another tool. Well, you can, if the json tree is extremely basic - like 2 levels. PowerShell also has a json parser tool: https://technet.microsoft.com/en-us/library/hh849898.aspx. It is called ConvertFrom-Json (follows the verb-noun convention) and is distributed as part of PowerShell (built-in if you want - but that's a misnomer for PowerShell modules). It is extremely simple - it doesn't even take any parameters - it just converts a string (parses it as json) and outputs the object/objects which can be arbitrarily complex. It truly does only one thing. If you want to select specific properties, sort, group etc you do it with other PS tools like select (alias for Select-Object), sort (alias for Sort-Object), group (alias for Group-Object) etc. If you want to convert back to json you use ConvertTo-Json.
配合 httpie 使用,jq 已成为日常工作必备
我已经用了几个月,配合 httpie,它已经像 grep 一样成为我工作日不可或缺的工具。
xahrepap查看英文原文
I've been using this for a couple months now. With httpie[1], it's become as essential to my work day as Grep. [1] https://github.com/jakubroztocil/httpie
jq 让用命令行探索 API 变得轻松,适合教学演示
很喜欢 jq……我意识到自己一直在强迫 bash 做它不擅长的事,而 jq 让探索 API 变得非常容易,我甚至用它做了讲解 Spotify API 和混搭 Instagram 图片的课程。
danso查看英文原文
Love, love jq...after awhile, I realized I was twisting my brain too much to get bash to do what it wasn't meant to do, but I got a lot of mileage of just playing with APIs because of how jq made it so easy. I came up with some fun lessons on how to use jq and other CLI-tools to tour the Spotify API [1] and to mash up images from Instagram [2] [1] http://www.compciv.org/recipes/data/touring-the-spotify-api/ [2] http://www.compciv.org/recipes/data/api-exploration-with-gmaps-instagram/ (note: while I say that I like the command-line, I'm not die-hard enough to have stopped to learn awk, so take that fwiw)
jq 让解析 AWS CLI 的 JSON 响应不再需要写 Python 脚本
我用它解析 AWS CLI 的 JSON 响应,非常好用。以前多数时候要写 Python 脚本来解析,现在一次性的任务用 bash 加 jq 就够了,需要长期维护的才用 Python 或 Ruby。
piva00查看英文原文
Using it for parsing AWS CLI responses, it's been a sweet tool to parse those JSON responses from AWS, most of the time I'd fire some python script to parse the data and now with jq I can keep most of the one-time scripts limited to bash only, if I need something more maintainable or longer living then I'll drop a script in python or ruby.
历次讨论
同类还值得读
直接在浏览器中启动 Linux 内核
Boot a linux kernel right inside your browser.
Fabrice Bellard 的 JSLinux 页面,用 JavaScript 在浏览器里启动一个 Linux 内核,并提供一个可交互的终端环境。
工具与资源上首页 5 次 · 2011–2025bellard.orgHacker News 未公开功能与行为清单(2018)
A List of Hacker News's Undocumented Features and Behaviors (2018)
数据科学家 Max Woolf 整理的 Hacker News 未公开功能与行为清单,涵盖投票机制、排名算法、账号惩罚等社区运作细节。
工具与资源上首页 5 次 · 2019–2025github.comMapSCII:在终端中用盲文和 ASCII 渲染地图
MapSCII – Braille and ASCII map renderer for the console
MapSCII 是一个在命令行终端里渲染地图的开源工具,用盲文字符和 ASCII 字符把地理数据画成可交互浏览的字符地图。
工具与资源上首页 5 次 · 2017–2025github.com顶尖大学的免费在线课程
Free Online Courses from Top Universities
Open Culture 整理的一份免费在线课程合集,汇集了全球顶尖大学(如 MIT、斯坦福、耶鲁等)向公众开放的网络课程资源,涵盖音频、视频等多种形式。
工具与资源上首页 5 次 · 2010–2022openculture.com淘气字符串:容易引发用户输入问题的字符串清单
Naughty Strings: A list of strings likely to cause issues as user-input data
一个 GitHub 仓库,收录了大量容易让程序出问题的用户输入字符串,如特殊字符、emoji、SQL 注入片段、系统命令等,供开发者用于测试输入处理逻辑。
工具与资源上首页 4 次 · 2015–2020github.com