This type of update is where the magic of +=
comes into play. With your input, the following invocation:
jq '.module.data.item_i77f664a2.fields += {"operation":"delete"}'
produces the output you indicate you want:
{
"success": true,
"module": {
"data": {
"item_i77f664a2": {
"id": "i77f664a2",
"tag": "item",
"fields": {
"cartItemId": 2012636322,
"operation": "delete"
},
"type": "biz"
}
}
}
}
However, I am not sure that this will produce what you want in similar circumstances, as you have referenced “item_i77f61ee2”.