Can you delete from objects in an array?
nixta opened this issue · comments
Let's say I have JSON that includes an array, each element of which is a JSON object. Can I modify those objects?
{
"items" : [
{ "geometry" : [0,0], "properties": { "name": "Null Island", "area": 1000 } },
{ "geometry" : [40.7128,-74.0060], "properties": { "name": "Manhattan", "area": 14604 } }
]
}
I can select and view items.#.properties.area
, but I'd like to delete area
from each item. Is that possible but I'm just doing it wrong?
I'm also interested in if there is a way to delete an entire object from the array if you don't know the index... i.e. by specifying a condition
it would be nice to say jj -D items.#[item_name="x"]
or jj -D items.#[properties.name="Manhattan"]
at the moment this seems to result in error: cannot delete value from a complex path
:-( so I'm having to resort back to jq
I'll probably raise new ticket if nobody can suggest a work around for this.