I currently have the following JSON output from echo $items | jq:
{
"Family_Name": "Type 1",
"Quantity_On_Hand": "335"
}
{
"Family_Name": "Type 2",
"Quantity_On_Hand": "215"
}
{
"Family_Name": "Type 9",
"Quantity_On_Hand": "159"
}
{
"Family_Name": "Type 4",
"Quantity_On_Hand": "500"
}
I also have a bash array colors of the same size looking like
"Blue" "Red" "Green" "Blue"
How can I use jq so that I get something like
{
"Family_Name": "Type 1",
"Quantity_On_Hand": "335",
"Colors": "Blue"
}
{
"Family_Name": "Type 2",
"Quantity_On_Hand": "215",
"Colors": "Red"
}
{
"Family_Name": "Type 9",
"Quantity_On_Hand": "159",
"Colors": "Green"
}
{
"Family_Name": "Type 4",
"Quantity_On_Hand": "500",
"Colors": "Blue"
}
I tried using something like jq --arg or jq -n '.{} |= [$colors]' but cannot get it correct.