Jeffail/gabs

Delete Array

Closed this issue · 1 comments

sp71 commented

The current Delete function is limited to basic json formats. If the JSON contains an array, we cannot delete the first item in the array or delete a key in the first element of a json array.

Hey @sp71, I think for the case of deleting a field from the first element of an array you should be able to do this:

array.Index(0).Delete(field)

For deleting the first element of an array you can use https://godoc.org/github.com/Jeffail/gabs#Container.ArrayRemove

I'm not at a PC right now to verify those solutions so let me know if they don't achieve what you need.