下記のようなデータが返ってきた大量の配列に対して、titleだけを抜き出したい場合
curl "https://qiita.com/api/v2/items?page=1&per_page=100" | jq '.title'
でいいのではと思いましたが、
jq: error (at <stdin>:0): Cannot index array with string "title"
と出力されてしまいます。
何がおかしいのでしょうか・・・?
[
{
"rendered_body": "<p>LIVE=>> <a href="http://streambuzz24.com/new-years-2019/" class="autolink" rel="nofollow noopener" target="_blank">http://streambuzz24.com/new-years-2019/</a></p>\n\n<p><a href="http://streambuzz24.com/new-years-2019/" rel="nofollow noopener" target="_blank"><img src="https://camo.qiitausercontent.com/2c9c8b521056c51f53ffb91f7a6c4a414c16b70d/68747470733a2f2f692e696d6775722e636f6d2f4f7277427271562e706e67" alt="" data-canonical-src="https://i.imgur.com/OrwBrqV.png"></a><br>\n<a href="http://streambuzz24.com/new-years-2019/" rel="nofollow noopener" target="_blank"><img src="https://camo.qiitausercontent.com/dee955cc7ebbd0916a5018ab7a72eb0e24de3279/68747470733a2f2f692e696d6775722e636f6d2f4b3948516f4e482e706e67" alt="" data-canonical-src="https://i.imgur.com/K9HQoNH.png"></a></p>\n",
"body": "LIVE=>> http://streambuzz24.com/new-years-2019/\n\n<a href="http://streambuzz24.com/new-years-2019/" rel="nofollow" data-slimstat="5"><img src="https://i.imgur.com/OrwBrqV.png" alt=""></a>\n<a href="http://streambuzz24.com/new-years-2019/" rel="nofollow" data-slimstat="5"><img src="https://i.imgur.com/K9HQoNH.png" alt=""></a>\n",
"coediting": false,
"comments_count": 0,
"created_at": "2019-01-01T05:03:37+09:00",
"group": null,
"id": "f04c8335c40742666b69",
"likes_count": 0,
"private": false,
"reactions_count": 0,
"tags": [
{
"name": "square",
"versions": []
},
{
"name": "Ball",
"versions": []
},
{
"name": "drop",
"versions": []
},
{
"name": "times",
"versions": []
},
{
"name": "2019",
"versions": []
}
],
"title": "Times Square Ball Drop 2019 Live StreaM",
"updated_at": "2019-01-01T05:04:04+09:00",
"url": "https://qiita.com/tertdfgdf/items/f04c8335c40742666b69",
"user": {
"description": null,
"facebook_id": null,
"followees_count": 0,
"followers_count": 0,
"github_login_name": null,
"id": "tertdfgdf",
"items_count": 1,
"linkedin_id": null,
"location": null,
"name": "",
"organization": null,
"permanent_id": 334740,
"profile_image_url": "https://secure.gravatar.com/avatar/050c5a57d5ecb01f765b9a583a07bb0e",
"team_only": false,
"twitter_screen_name": null,
"website_url": null
},
"page_views_count": null
}
]

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/12/31 21:25
退会済みユーザー
2018/12/31 21:27