I have a json file where i need to change some key:values. The Key and values are dynamic and are stored in a array. I just need to parse the file and replace value corresponding to the particular key.
foo="user"
cat properties.json | jq '.node.${foo}' > tempo.json
So if i tried the following command errors are thrown ..
jq: error: syntax error, unexpected '$', expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at <top-level>, line 1:
.master_node.$foo
jq: 1 compile error
Tried lot of commands.. But i could not pass variable while traversing a json tree.. Appreciate any help