This is my JSON file which I get from an external link:
[
{
"Id":441,
"Name":"Gary"
},
{
"Id":1864,
"Name":"Bob"
}
]
When I try and display the Id and Name, I receive the error:
Notice: Trying to get property of non-object
$file = file_get_contents('http://linktojson.com');
$decode = json_decode($file, false);
$name = $decode->Name;
$id = $decode->Id;
echo $name;
echo $id;