Question:
I have a problem to generate a json in php, after the query it returns this
{"37":{"codigo":"37","firstname":"Aluno","lastname":"Toledo","atividade":"A","checklist":null},
"1475":{"codigo":"1475","firstname":"Alzira","lastname":" Cabral","atividade":"A","checklist":"C"}}
is there how I can remove the "37" and the "1475"??
because I want to solve this problem, when I call it in an http.get by angular, it's sorting by this json "header"…
Answer:
<?php
$array = json_decode('{"37":{"codigo":"37","firstname":"Aluno","lastname":"Toledo","atividade":"A","checklist":null},
"1475":{"codigo":"1475","firstname":"Alzira","lastname":" Cabral","atividade":"A","checklist":"C"}}', 1);
$result = array();
foreach ($array as $key => $value)
{
$result[] = $value;
}
echo json_encode($result);