I have some JSON that looks like this:
{
people: []
}
My Goal at the moment is to simply add elements to the array of people. But in the end I also would like to be able to remove the elements again.
I have tried something like:
<?
$file = "test.json";
$json = file_get_contents($file);
$get = json_decode($json);
array_push($get->people, $_GET['person']);
file_put_contents($file, json_encode($get));
?>
However, this does not work. I'm pretty sure there is an easier solution for this. Thanks for any help.