偉大なる元記事: jqでハイフン(-)を含むkeyでフィルタできないときの対処法
$ cat test.json | jq '.["foo-bar"]'
これが動かなかったので調べ直しになってしまった。
MacbookProに入れたjqが新しい、もしくは古いので非サポートになったのかな?
$ jq --help
jq - commandline JSON processor [version 1.5]
詳しくは
Github: Cannot select field if field name has dashes #38
元記事にリンクが張ってあるので確認、
hexsel commented on 25 Mar 2016
Just for posterity, the following seems to work:
jq .\"a-b\"
Seems like the shortest working query string with a hyphen.
どれどれ、実際にjqの1.5で確かめてみたところ、
'."key-of-path"'
で値を抜き出す事に成功。
1.5以降のバージョンの人はこちらも試してみてね。