I have a file with the below contents and a shell variable with some keys. I want to create nested JSON using all keys. eg:
file.json:
{
"name":"..",
"value":".."
}
shell variable which contains list of keys:
values=('one' 'two' 'three')
I want to create a variable like below:
{
"all":{
"one": {
"name":"..",
"value":".."
},
"two": {
"name":"..",
"value":".."
},
"three": {
"name":"..",
"value":".."
}
}
}
I tried to pass the values are --arg to JQ, but it didnt work. JQ version: 1.5.