DistanceMatrix API の結果を JSON 形式に変換できません。
これは var_dump です$response
(Laravel 5.1 では Ivory\googlempas プラグインを使用しています)
object(Ivory\GoogleMap\Services\DistanceMatrix\DistanceMatrixResponse)#694 (4) { ["status":protected]=> string(2) "OK" ["destinations":protected]=> array(1) { [0]=> string(12) "Milan, Italy" } ["origins":protected]=> array(1) { [0]=> string(11) "Rome, Italy" } ["rows":protected]=> array(1) { [0]=> object(Ivory\GoogleMap\Services\DistanceMatrix\DistanceMatrixResponseRow)#693 (1) { ["elements":protected]=> array(1) { [0]=> object(Ivory\GoogleMap\Services\DistanceMatrix\DistanceMatrixResponseElement)#692 (3) { ["status":protected]=> string(2) "OK" ["distance":protected]=> object(Ivory\GoogleMap\Services\Base\Distance)#690 (2) { ["text":protected]=> string(6) "572 km" ["value":protected]=> int(572343) } ["duration":protected]=> object(Ivory\GoogleMap\Services\Base\Duration)#691 (2) { ["text":protected]=> string(15) "5 hours 42 mins" ["value":protected]=> int(20517) } } } } } }
JSON配列で返すにはどうすればよいですか?