CakePHP3.4: How to send a json object response?
问题 I try to migrate to 3.4 and I have a problem to send a json object. Up to 3.3, I used the following code: $jsonSites = json_encode([ 'reqLocation' => [ 'latitude' => $latitude, 'longitude' => $longitude ], 'sites' => $sitesList, 'discoveryBooks' => $discoveryBooksList, 'deleteSites' => !empty($inDeviceSites) ? [$inDeviceSites] : [], 'deleteBooks' => !empty($inDeviceBooks) ? [$inDeviceBooks] : [] ]); $this->response->type('application/json'); $this->response->body($jsonSites); And my client