Decodes JSON string into an associative array

@param string $json
@return array
@throws DecodingException
540145
public function decode(string $json): array
    {
        $decoded = \json_decode($json, true);
        if (\json_last_error() !== JSON_ERROR_NONE) {
            throw new DecodingException(\json_last_error_msg(), \json_last_error());
        }
        return $decoded;
    }
1112058
public function asArray(bool $decodeJSON = true) : array
    {
        if(!$decodeJSON) {
            return $this->_data;
        }

        $return = [];
        foreach($this->_data as $key => $value) {
            $decoded = json_decode($value);

            $return[$key] = $decoded;
            if(
                !is_array($decoded)  &&
                !is_object($decoded)
            ) {
                $return[$key] = $value;
            }
        }

        return $return;
    }
279679
private function decode($json)
	{
		// Attempt to fix bad UTF-8 data when the right flag is set on the client
		if (BaseClient::$flags & BaseClient::FLAG_ATTEMPT_UTF8_RECOVERY)
			if (!preg_match("//u", $json))
				$json = utf8_encode(utf8_decode($json));
		
		$response = json_decode($json);
		$errorCode = json_last_error();

		switch ($errorCode)
		{
			case JSON_ERROR_DEPTH:
				$errorDescription = 'Maximum stack depth exceeded';
				break;
			case JSON_ERROR_STATE_MISMATCH:
				$errorDescription = 'Underflow or the modes mismatch';
				break;
			case JSON_ERROR_CTRL_CHAR:
				$errorDescription = 'Unexpected control character found';
				break;
			case JSON_ERROR_SYNTAX:
				$errorDescription = 'Syntax error, malformed JSON';
				break;
			case JSON_ERROR_UTF8:
				$errorDescription = 'Malformed UTF-8 characters, possibly incorrectly encoded';
				break;
			default:
				$errorDescription = 'Unknown error';
				break;
		}

		if ($errorCode !== JSON_ERROR_NONE)
			throw new Exception\InvalidResponseException('Unable to decode JSON response: '.$errorDescription, $errorCode);

		return $response;
	}
77760
public function decodeJson($string)
    {
        return json_decode(
            $string,
            $this->format->isJsonDecodeAssoc(),
            static::JSON_DEFAULT_DEPTH,
            $this->format->getJsonDecodeOptions()
        );
    }
1019012
public static function decode(
        string $json,
        bool $assoc = true,
        int $depth = 512,
        int $options = 0,
        string $context = ''
    ) {
        // Clear json_last_error()
        json_encode(null);

        $value = json_decode($json, $assoc, $depth, $options);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new JsonError(
                sprintf(
                    'Unable to decode JSON: %s. %s',
                    json_last_error_msg(),
                    $context
                )
            );
        }

        return $value;
    }
884986
private function parseJson($json)
    {
        $jsonPayload = json_decode($json, true);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new ParserException('Error parsing JSON: '
                . json_last_error_msg());
        }

        return $jsonPayload;
    }
278196
private function jsonToArray($json)
	{
		try {
			$data = json_decode($json, true);
			if(is_array($data)) {
				return $data;
			}
			else {
				$this->error = 'The given data string was not json';
				return [];
			}
		}
		catch(Exception $e) {
			$this->error = $e;
		}
	}
191828
public static function decode($jsonString)
    {
        $jsonData = json_decode($jsonString, true);
        if (null === $jsonData && JSON_ERROR_NONE !== json_last_error()) {
            throw new JsonException('unable to parse/decode JSON');
        }

        if (!\is_array($jsonData)) {
            throw new JsonException(sprintf('expected JSON object, got "%s"', \gettype($jsonData)));
        }

        return $jsonData;
    }
199286
public static function decode(string $json, int $flags = 0)
    {
        $forceArray = (bool)($flags & self::FORCE_ARRAY);
        $value = json_decode($json, $forceArray, 512, JSON_BIGINT_AS_STRING);
        if ($error = json_last_error()) {
            throw new JsonException(json_last_error_msg(), $error);
        }

        return $value;
    }
315694
public static function json_decode($data)
    {
        $data_json = @json_decode($data, true);
        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \Exception(
                sprintf('An error occurred while trying to decode JSON data [code "%s"]!', json_last_error())
            );
        } else {
            $data = $data_json;
        }
        return $data;
    }
845604
public function jsonDecode($string, $assoc = false, $depth = 512, $options = 0)
    {
        return json_decode($string, $assoc, $depth, $options);
    }
1132630
protected function parse_json( $json ) {

		$data = json_decode( $json, true );

		if ( ! is_array( $data ) ) {
			$data = array();
		}

		return $data;
	}
288522
private function simple_json_parser($json){
        $json = str_replace("{","",str_replace("}","", $json));
        $jsonValue = explode(",", $json);
        $arr = array();
        foreach($jsonValue as $v){
            $jValue = explode(":", $v);
            $arr[str_replace('"',"", $jValue[0])] = (str_replace('"', "", $jValue[1]));
        }
        return $arr;
    }
609054
public static function decode($json)
    {
        $flags = 0;
        if (PHP_INT_SIZE === 4) {
            $flags |= JSON_BIGINT_AS_STRING;
        }
        $data = json_decode($json, false, 512, $flags);
        $error = json_last_error();
        if ($error !== JSON_ERROR_NONE) {
            throw new \InvalidArgumentException(sprintf('Failed to decode JSON (%d): %s.', $error, json_last_error_msg()));
        }

        return $data;
    }
71920
private function decodeJson($value)
    {
        $decodedValue = json_decode($value, true);
        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new \InvalidArgumentException('JSON parsing error: ' . json_last_error_msg());
        }

        return $decodedValue;
    }
130097
public function decode($jsonString)
    {
        $jsonString = $this->normalize($jsonString);
        $this->parser->parse($jsonString);

        return json_decode($jsonString, true);
    }
1143673
public function decode(string $json)
    {
        // max depth is 0+ for json_encode(), and 1+ for json_decode()
        $result = json_decode($json, $this->decodeObjectAsArray, $this->maxDepth + 1, $this->options);

        $this->checkLastError();

        return $result;
    }