タグ

cuiとjsonに関するanimistのブックマーク (3)

  • jq コマンドが強力すぎてヤバい件

    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", "

    jq コマンドが強力すぎてヤバい件
  • jq コマンドを使う日常のご紹介 - Qiita

    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には配

    jq コマンドを使う日常のご紹介 - Qiita
  • jq

    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

    animist
    animist 2015/06/01
    JSON をパースして sed / awk / grep みたいな事を可能にしてくれるコマンド。くっそ便利そう
  • 1