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

How to only update a specific object in json using jq

$
0
0

I read a json from a file, manipulated one of the fields such as below and got the output on terminal

cat list.json | jq ".module.home.[].names | map(.long=\"$long\")"

However, the original file i.e. list.json is still having old values. How do I update only this object back in the original file.

Solutions such as here replaces the whole content with the output of command. However, what I want to is only update a particular object such as ".module.home.[].names in it, and leave the rest as it is.


Viewing all articles
Browse latest Browse all 657

Trending Articles



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