Well I get the following JSON via post:
string '{
"pedidos": [{
"feito_data": "2017-08-07",
"valor": 40.0
}]
}' (length=265)
With php I treat the data like this:
// Recebe dados do JSON
$mix = filter_input(INPUT_POST, 'json', FILTER_DEFAULT);
// Decodifica json
$jsonObj = json_decode($mix);
// Faz o parsing da string, criando o array
$mix = $jsonObj->pedidos;
// Navega pelos elementos do array, e cadastra novos clientes
foreach ($mix as $c) {
echo $c->feito_data;
}
Well what I want to do is the following, as json will only send me 1 result I do not need to use foreach
and I do not need to give a name to the object as pedidos
.
My question is how to receive the data so $c->feito_data
?