I am using php version 7.1.3 with the symfony version 4.2.12
here is the array data
$json = [
'totalVehicle' => $totalVehicle,
'totalPrice' => $totalPrice,
'vehicles' => $xvehicles,
'toDateTime' => $toDateTime,
'fromDateTime' => $fromDateTime,
'distanceMile' => $distanceMile,
'toCity' => $toCity,
'fromCity' => $trip->getFromPlace(),
'trip' => $trip,
'adaAssistance' => $request->get('ada', false),
'vehiclesCount' => $vehiclesCount,
'pageCurrent' => $request->get('page', 0),
'uri' => $uri,
'maxPage' => floor($vehiclesCount / 15),
'isSubscribed' => $isSubscribed,
];
when i use dd($json) it returns the actual array,
dd($json);
when i want to return it in json format by using json_encode it return false,
$json = json_encode($json,0,512);
I tried to change the depth upto 1024 but the result is same with false return,
Please help me out to solve this,

