I have the following example data in PHP:
[{"id": 2088996538},{},{"id": 2077495673}]
How can I end up with
[{"id": 2088996538},{"id": 2077495673}]
I've tried several things, like
unset($activities[1]);
but then I end up with
{"0":{"id":2088996538},"2":{"id":2077495673}}
It looks like something soo simple, but can't figuring it out.
The ultimate goal is to clean up some strava api output, deleting everything I don't use.
Edit:
$activities = json_decode('[{"id": 2088996538},{},{"id": 2077495673}]');
unset($activities[1]);
$activities = array_values($activities);
echo json_encode($activities);
this actually works, how could I've missed it. Gonna try it out with the larger data set. Thanks!
array_values.