src/ApiProblem.php
public function asJson(bool $pretty = false): string
    {
        $response = $this->compile();

        $options = 0;
        if ($pretty) {
            $options = \JSON_UNESCAPED_SLASHES | \JSON_PRETTY_PRINT;
        }

        $json = json_encode($response, $options);

        if (false === $json) {
            throw JsonEncodeException::fromJsonError(\json_last_error(), $response);
        }

        return $json;
    }
public function asJson(bool $pretty = false): string
    {
        $response = $this->compile();

        $options = 0;
        if ($pretty) {
            $options = \JSON_UNESCAPED_SLASHES | \JSON_PRETTY_PRINT;
        }

        $json = json_encode($response, $options);

        if (false === $json) {
            throw JsonEncodeException::fromJsonError(\json_last_error(), $response);
        }

        return $json;
    }
public function asJson ( bool $ pretty = false ) : string { $ response = $ this -> compile ( ) ; $ options = 0 ; if ( $ pretty ) { $ options = \ JSON_UNESCAPED_SLASHES | \ JSON_PRETTY_PRINT ; } $ json = json_encode ( $ response , $ options ) ; if ( false === $ json ) { throw JsonEncodeException :: fromJsonError ( \ json_last_error ( ) , $ response ) ; } return $ json ; }
Renders this problem as JSON.

@param bool $pretty
Whether or not to pretty-print the JSON string for easier debugging.
@return string
A JSON string representing this problem.
Renders this problem as JSON .