response->withBody(new Stream('[object]')); } if (is_array($result)) { return $this->response->withBody(new Stream(json_encode($result, JSON_UNESCAPED_UNICODE))); } else { return $this->response->withBody(new Stream((string)$result)); } } }