Uhmm però questo metodo mi sembra migliore:
Codice PHP:$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
try{
if(!($json=json_decode($json)) instanceof stdClass){
throw new Exception('The parameter is not an object !');
}
}
catch (Exception $e){
echo 'Caught exception: ', $e->getMessage(), "\n";
exit();
}
var_dump($json);
![]()


Rispondi quotando