public function parse($json, $assoc = false, $depth = 512)
    {
        if (null === ($data = json_decode($json, $assoc, $depth))) {
            if (JSON_ERROR_UTF8 === json_last_error()) {
                throw JsonException::invalidUtf8();
            }

            $this->checkSyntax($json);
            // @codeCoverageIgnoreStart
        }
        // @codeCoverageIgnoreEnd

        return $data;
    }
public function parse($json, $assoc = false, $depth = 512)
    {
        if (null === ($data = json_decode($json, $assoc, $depth))) {
            if (JSON_ERROR_UTF8 === json_last_error()) {
                throw JsonException::invalidUtf8();
            }

            $this->checkSyntax($json);
            // @codeCoverageIgnoreStart
        }
        // @codeCoverageIgnoreEnd

        return $data;
    }
public function parse ( $ json , $ assoc = false , $ depth = 512 ) { if ( null === ( $ data = json_decode ( $ json , $ assoc , $ depth ) ) ) { if ( JSON_ERROR_UTF8 === json_last_error ( ) ) { throw JsonException :: invalidUtf8 ( ) ; } $ this -> checkSyntax ( $ json ) ; // @codeCoverageIgnoreStart } // @codeCoverageIgnoreEnd return $ data ; }
Parses a JSON string.

@param string  $json  The JSON string.
@param boolean $assoc Convert objects to associate arrays?
@param integer $depth The maximum recursion depth.

@return mixed The parsed data.

@throws JsonException If the JSON string could not be parsed.

@api
Parses a JSON string .