ManaPHP\Http\Response::setJsonContent PHP Method

setJsonContent() public method

Sets HTTP response body. The parameter is automatically converted to JSON $response->setJsonContent(array("status" => "OK")); $response->setJsonContent(array("status" => "OK"), JSON_NUMERIC_CHECK);
public setJsonContent ( array $content, integer $jsonOptions = null ) : static
$content array
$jsonOptions integer consisting on http://www.php.net/manual/en/json.constants.php
return static
    public function setJsonContent($content, $jsonOptions = null)
    {
        $this->setContentType('application/json', 'utf-8');
        if ($jsonOptions === null) {
            $jsonOptions = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT;
        }
        $this->_content = json_encode($content, $jsonOptions, 512);
        return $this;
    }