I'm new in using jq
library, Here i'm reading HotelInfo
field of my json:
./jq-linux64 '.HotelInfo' 74687.json
{
"HotelURL": "http://www.tripadvisor.com/aaa.html",
"HotelID": "74687",
"Price": "$156"
}
Now, i'm going to add {city: tehran}
object to this array :
./jq-linux64 --arg city tehran '.HotelInfo +{city: $city}' 74687.json
{
"HotelURL": "http://www.tripadvisor.com/aaa.html",
"HotelID": "74687",
"Price": "$156",
"city": "tehran"
}
And it's done, but this doesn't reflect on file too and file still not updated with this new record, How can i update the json file as well?