In zend framework for APIs, I am using $this->_helper->json($data) to return json data
public function get()
{
$data = ['id' => 1, 'name' => 'xyz'];
return $this->_helper->json($data);
}
Here I want to declare return type for this method. Generally for json_encode return type is string, but here what is the exact retun type to delcare in method return type.
PHP doesn't have a nataive dataype for JSON, it's a structured string so your function is returning a string.