Appologies if I've overlooked something very obvious; I've just found jq
and am trying to use it to update one JSON value without affecting the surrounding data.
I'd like to pipe a curl
result into jq
, update a value, and pipe the updated JSON to a curl -X PUT
. Something like
curl http://example.com/shipping.json | jq '.' field: value | curl -X PUT http://example.com/shipping.json
So far I've hacked it together using sed
, but after looking at a few examples of the |=
operator in jq
I'm sure that I don't need these.
Here's a JSON sample--how would I use jq
to set "local": false
, while preserving the rest of the JSON?
{
"shipping": {
"local": true,
"us": true,
"us_rate": {
"amount": "0.00",
"currency": "USD",
"symbol": "$"
}
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…