How to extract keys from multiple, nested arrays using jq

前端 未结 1 2255
余生分开走
余生分开走 2021-02-20 13:54

SETUP

I\'m trying to figure out how jq filters work and having trouble figuring out nested arrays. Using the data below I cannot make a flat 5 key outpu

相关标签:
1条回答
  • 2021-02-20 14:28

    You can use a variable to store the OwnerID as in:

    .Reservations[] | .OwnerId as $OwnerId | ( .Instances[] | { "OwnerId": $OwnerId, InstanceId, ImageId, PrivateIpAddress, Platform} )
    
    0 讨论(0)
提交回复
热议问题