I want to get json from url but when i try the dd($data) i got parse error on line 1: bla bla expect string error.
First, i doubted with my json object is invalid then i tried with jsontest object but i got still same error. Here is the simple code:
$stationData = file_get_contents("http://ip.jsontest.com/");
$stationData = json_decode($stationData);
dd($stationData);
And, this is the error message:
Error: Parse error on line 1:
{#149 ▼ +"ip": "95.
-^
Expecting 'STRING', '}'
If i use json_decode($data, true) i got valid array instead of json object.
What's wrong with this?
print_rfor exampleprint_r($stationData->ip);instead ofdd($stationData)?{#144 ▼ +"ip": "104.155.78.120" }