Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 657

How to get all objects of JSON array with specific keys using jq? [closed]

$
0
0
{"mainKey": "mainValue","date": "X","values": [    {"keyType1": "someValueX"    },    {"keyType1": "someValueY"    },    {"keyType2": "someValueZ"    },    {"keyType2": "someValueC"    },  ]}

I need to get all values of objects with keyType1 key only.

I've tried something like that

jq '.values[] | select(.key=="keyType1")'

but it has no output.


Viewing all articles
Browse latest Browse all 657

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>