eZ\Publish\Core\REST\Common\Input\Handler\Json::convert PHP Method

convert() public method

Converts the given string to an array structure.
public convert ( string $string ) : array
$string string
return array
    public function convert($string)
    {
        $json = json_decode($string, true);
        if (JSON_ERROR_NONE !== ($jsonErrorCode = json_last_error())) {
            $message = "An error occured while decoding the JSON input:\n";
            $message .= $this->jsonDecodeErrorMessage($jsonErrorCode);
            $message .= "\nInput JSON:\n\n" . $string;
            throw new ParserException($message);
        }
        return $json;
    }