I need help appending a value to an array using jq. I tried appending the json using this command below.
jq '.[] |= .+ {"ID": "C", "location":"France"}' original.json > new.json
The original.json contains this array:
[
{"ID": "A", "location":"Canada"},
{"ID": "B", "location":"Singapore"}
]
but I end up replacing the current values with the new inserted value. Can anyone help me with this?