Modify/delete nested/selected values with jq and output entire document
I’m migrating between Terraform providers, and to resolve a bug I need to change the tfstate
files which are huge JSON blobs. Namely two fields:
How to udpate a value in a nested and partly flattened object with jq?
I need to override the property version
with the value of image
. The problem is, that the json document can have several forms, whereby parts of the nesting can be flattened:
Returning an entries from a nested json through jq
For a given json:
copy a value to another entry in the same element
There are plenty of examples of updating a value in a nested entry in jq, but I think I have a unique question, because the value I want to provide is already in another part of the same entry.
JQ transformation
Suppose I have a json object like this
How to substract inner array value from outer array value?
I have the following test.json
file: