/** * create a JSON string from our modified result from google api * * @return string */ private function parseResponse() { $response = array(); $response['places'] = array(); $data = Transform::jsonToArray($this->responseBody); if ($this->request->getAutoComplete()) { if (isset($data['predictions'])) { foreach ($data['predictions'] as $result) { $response['places'][] = $result['description']; } } } else { if (isset($data['results'])) { foreach ($data['results'] as $result) { $response['places'][] = $result['formatted_address']; } } } return json_encode($response, JSON_UNESCAPED_UNICODE); }