Closed nikolaynesov closed 5 years ago
quick and dirty workaround would be
json_encode(array_values((array)geoip()->getLocation())[0])
If using Laravel this also works Response::json(geoip()->getLocation()->toArray());
I am using Laravel.
$location = GeoIP::getLocation(); $locationArray = $location->toArray(); $jsonData = json_encode($locationArray); dd($jsonData);
Json encoding of Torann\GeoIP\Location returns empty string. Expected: json encoded attributes.