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

How to copy from object with out using the table index

$
0
0

The input is

{"zoo": [   { "x": { "guesst": "" } },   { "y": { "guesst": "zebra" } }  ]}

And i need the output like

{"zoo": [   { "x": { "guesst": "zebra" } },   { "y": { "guesst": "zebra" } }  ]}

I did:

jq '.zoo[0].x.guesst = .zoo[1].y.guesst'

But, what if i do not know the order of the objects in the array?


Viewing all articles
Browse latest Browse all 575

Trending Articles



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