I'm trying to append some data to json, but the output ([[],[],[]]
) isn't what I expected
Here's my code:
$utenti = json_decode('{"123":[],"456":[]}', true);
$newUtenti = ["789" => []];
$newUtenti = array_merge($utenti, $newUtenti);
echo json_encode($newUtenti);
What am I doing wrong?
This is the expected output: {"123":[],"456":[], "789": []}