JSONを操作するコマンドラインツールであるjqは、これまでオリジナル作者であるStephen Dolan氏 (@stedolan)のリポジトリ(github.com/stedolan/jq)で管理されていました。 メンテナンスはNico Williams氏 (@nicowilliams)とWilliam Langford氏 (@wtlangford)の二名が行なっていましたが、近年は活動が減っておりメンテナンスが滞っていることが度々指摘されていました。 最新のリリースは2018年11月に行われた1.6であり、その後に様々なバグ修正やパフォーマンス改善、新機能の実装が行われているのにリリースされておらず、またissueやPRも放置されがちになっていました。 さらにCI (AppVeyor)は常に落ちるので、簡単なドキュメント修正でもCIが通らず苦情が来る、数か月放置されたPRは作った人が諦
gojq is purely implemented with Go language and is completely portable. jq depends on the C standard library so the availability of math functions depends on the library. jq also depends on the regular expression library and it makes build scripts complex. gojq implements nice error messages for invalid query and JSON input. The error message of jq is sometimes difficult to tell where to fix the q
jqはとても便利なコマンドです。 JSONを返すAPIを実装するときや、SaaSのAPIから特定の情報を抜き出してシェル変数に代入するときなど、web開発や運用には欠かせないツールとなっています。 しかし、私にとってjqのクエリを一発で書くのは容易ではなく、思い通りの出力が得られないことがよくありました。 難しいエラーメッセージに悩まされて、jqで書くのを諦めて別の言語で書き直すこともありました。 jqの十八番と思える場面で使いこなせないのは、なかなか悔しいものがあります。 ツールを使うのが難しいなら、同じものを作ってしまえばよいのです。 jqの全ての機能を実装する jqを言語としてきちんと書けるようになる jqを完全に理解する jqの全ての機能を自分で実装してしまえば、jqがどういうものか、クエリがどのように処理されるのか、詳しくなれるはずです。 jqを得意な言語と言えるようになって、ク
CSV, TSV, and other delimiter-separated value formats. Tools belong on this list if they support field quoting. csv-nix-tools — List *nix system information such as environment variables, files, processes, network connections, users as CSV. Manipulate and pretty-print CSV. Execute CSV rows as commands. csv2html — Convert CSV to HTML tables. csv2md — Convert CSV to Markdown tables. csvfaker — Gener
Make JSON greppable! gron transforms JSON into discrete assignments to make it easier to grep for what you want and see the absolute 'path' to it. It eases the exploration of APIs that return large blobs of JSON but have terrible documentation. ▶ gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | fgrep "commit.author" json[0].commit.author = {}; json[0].commit.author.date = "2
jq コマンドとは http://stedolan.github.io/jq/ JSONから簡単に値を抜き出したり、集計したり、整形して表示したりできるJSON用のgrepとかawkみたいなコマンドです。 WebサービスがJSONを吐いたり、AWS CLIが JSON を吐いたりする現代社会で大変便利なコマンドです。 マニュアル だいたいここ読めばOK. http://stedolan.github.io/jq/manual/ あ、これで、終わってしまう。だけど気にせず進めます。 簡単な例 まず、空気をつかみましょう。 以下jqコマンドの記法を見ていきます。JSON { "hoge": "value" } があった場合、 . がルート {} を表します。.hoge で "value" を表現します。だいたいこんな感じです。 ただの整形 しばらく下記のJSONを例に進めます。itemsには配
JSON の内容を sed や awk のようにフィルタ・加工するためのプログラムに jq がある。 JSON 形式で提供されている WebAPI の出力や、ログの内容を扱うのにとても便利。 その強力さの一端を紹介したい。 インストールは Mac OS X であれば Homebrew から。公式サイトからバイナリをダウンロードすることもできる。 $ brew install jq サンプル用の JSON を用意しておく。 $ cat << EOS > jsonfile {"name": "Foo", "sex": "Male", "age": 15, "emails": []} {"name": "Bar", "sex": "Male", "age": 20, "emails": ["hoge@example.jp"]} {"name": "Baz", "sex": "Female", "
Data science is OSEMN (pronounced as awesome). That is, it involves Obtaining, Scrubbing, Exploring, Modelling, and iNterpreting data. As a data scientist, I spend quite a bit of time on the command-line, especially when there’s data to be obtained, scrubbed, or explored. And I’m not alone in this. Recently, Greg Reda discussed how the classics (e.g., head, cut, grep, sed, and awk) can be used for
jq is a lightweight and flexible command-line JSON processor. jq is like sed for JSON data - you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text. jq is written in portable C, and it has zero runtime dependencies. You can download a single binary, scp it to a far away machine of the same type, and expect
We’ve made the very difficult decision to cancel all future O’Reilly in-person conferences. Instead, we’ll continue to invest in and grow O’Reilly online learning, supporting the 5,000 companies and 2.5 million people who count on our experts to help them stay ahead in all facets of business and technology. Come join them and learn what they already know. Become an O’Reilly online learning member
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く