Using jq to fetch key value from json output

后端 未结 3 934
感情败类
感情败类 2021-02-12 08:24

I have a file that looks as below:

{
  \"repositories\": [
   {
    \"id\": \"156c48fc-f208-43e8-a631-4d12deb89fa4\",
    \"namespace\": \"rhel12\",
    \"namesp         


        
3条回答
  •  北荒
    北荒 (楼主)
    2021-02-12 08:50

    You want to look at the repositories array instead of treating the input as an array:

    $ jq -r '.repositories[].name' file
    rhel6.6
    rhel7
    

提交回复
热议问题