0
Well get a json on my page like this:
// Decodifica o Json
$obj = json_decode(file_get_contents('php://input'));
echo $obj->Autenticacao[0]->login;
The Json that is being sent is like this:
{
"Autenticacao": [{
    "login": "root",
    "senha": "123"
}]
}
Everything works 100%, but whoever removes [] from json, php tells me the following error:
Fatal error: Cannot use object of type stdClass as array
How to identify if the full json.
If you don’t have
[]it is no longer possible to doAutenticacao[0], it would have to be just$obj->Autenticacao->login. is_object can verify if a given field is an object and is_array to see if it’s array.– Isac