json响应错误检查php

true json url

$url = 'https://tr.api.pvp.net/api/lol/tr/v1.4/summoner/by-name/r2aper1tuar?api_key=RGAPI-2F65B634-F9C5-4DA7-A5E3-1D955D5D1E3B';
$content = file_get_contents($url);
$json = json_decode($content);

These codes work but if JSON url is not true. It will show error on index.php How can i check these error.

not true json

if i use "not true JSON" , I take this error.

{
"status": {
    "message": "Not Found",
    "status_code": 404
    }
}

Now how to check errors ?

Check the response:

if( property_exists ( $json , "status" ) )
{
    $status_code = $json -> status -> status_code;
    $message = $json -> status -> message;

    // do something...
}