@param string $json
@param int $flags

@return mixed
@throws JsonException
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;
    }
1278398
public static function fromJson(
        string $name,
        bool $endsWithSession,
        DateTimeImmutable $issuedAt,
        string $json
    ) : self {
        $cookie = new self($name, $endsWithSession, $issuedAt);
        $cookie->data = json_decode($json, true);

        if (! is_array($cookie->data)) {
            throw JsonException::fromJsonDecodeError(json_last_error_msg());
        }

        return $cookie;
    }
246543
private function checkForCurlErrors($json)
    {
        if ($json && isset($json->errors)) {
            // Get errors
            $errors = implode(', ', array_map(function ($error) {
                return $error->message;
            }, $json->errors));

            // fetch sync key for event handling
            if (isset($json->sync)) {
                $this->syncKey = $json->sync;
            }

            throw new Exception($errors, $this->http_code);
        }
    }
1185232
public function parseJson($json)
    {
        $this->mentionName = $json['mention_name'];
        $this->id = $json['id'];
        $this->name = $json['name'];
        if (isset($json['links'])) {
            $this->links = $json['links'];
        }
        if(isset($json['xmpp_jid'])) {
            $this->xmppJid = $json['xmpp_jid'];
            $this->deleted = $json['is_deleted'];
            $this->lastActive = $json['last_active'];
            $this->title = $json['title'];
            $this->created = new \Datetime($json['created']);
            $this->groupAdmin = $json['is_group_admin'];
            $this->timezone = $json['timezone'];
            $this->guest = $json['is_guest'];
            $this->email = $json['email'];
            $this->photoUrl = $json['photo_url'];
        }
    }
1114709
function decodeJSON($json)
    {
        $json_response = json_decode($json);
        if ($json_response === null) {
            throw new Clientside\Exception("Unable to decode JSON response from: {$json}");
        }
        return $json_response;
    }
966954
public static function fromJson($json)
    {
        $data = json_decode((string)$json, true);

        if (json_last_error() !== JSON_ERROR_NONE || !is_array($data)) {
            throw new \UnexpectedValueException('Invalid JSON message.');
        }

        return new static($data);
    }
1266635
protected function renderJSON($data = [], $status = 200, $flags = null)
    {
        $rendered = View::renderJSON($data, $flags);

        $this->response->getBody()->rewind();
        $this->response->getBody()->write($rendered);

        return $this->getResponse()
            ->withStatus($status)
            ->withHeader('Content-Type', 'application/json; charset=utf-8');
    }
230037
public function fromJson($json) {
    Helpers::checkType('json', 'string', $json);
    $decoded_value = json_decode($json);
    if ($decoded_value === null && ($json !== 'null' || $json !== '')) {
      throw new \Exception('Invalid JSON.');
    }
    return $this->setValue($decoded_value);
  }
1145176
private function _post($url, &$json)
    {
        curl_setopt($this->_curlHandle, CURLOPT_CUSTOMREQUEST, 'POST');
        return $this->_curlHelper($url, $json);
    }
117944
public function decode($json)
    {
        $data = json_decode($json, true);
        if ($data === null && json_last_error() != JSON_ERROR_NONE) {
            throw new JsonSerializerException('Invalid JSON to unserialize.');
        }

        if (!is_array($data)) {
            throw new JsonSerializerException('Given JSON cannot represent an object.');
        }

        if (mb_strpos($json, $this->encodingAnnotation) !== false) {
            $data = $this->decodeNonUtf8FromUtf8($data);
        }

        return $data;
    }
638773
public function get($key)
	{
		if(($key === NULL) || $key === '')
		{
			throw new JSONException('Null key.');
		}
		
		$object = $this->opt($key);
		
		if($object == NULL)
		{
			throw new JSONException('JSONArray[' . JSONObject::quote($key) . '] not found.');
		}
		
		return $object;
	}
863330
public static function fromJson($json)
    {
        $responseData = json_decode($json, true);

        if ( ! $responseData)
            return new static(false, [ResponseV3::E_INVALID_JSON]);

        return static::fromArray($responseData);
    }
964451
public static function encode($value, int $flags = 0): string
    {
        $flags = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | (($flags & self::PRETTY) ? JSON_PRETTY_PRINT : 0) | (defined('JSON_PRESERVE_ZERO_FRACTION') ? JSON_PRESERVE_ZERO_FRACTION : 0);
        $json = json_encode($value, $flags);
        if ($error = json_last_error()) {
            throw new JsonException(json_last_error_msg(), $error);
        }

        return $json;
    }
358200
public static function jsonDeserialize(string $json): self
    {
        $data = array_replace(['path' => null, 'filters' => null, 'force' => false], JSON::decode($json));

        if (!$data['path']) {
            throw new LogicException('The message does not contain "path" but it is required.');
        }

        if (!(null === $data['filters'] || \is_array($data['filters']))) {
            throw new LogicException('The message filters could be either null or array.');
        }

        return new static($data['path'], $data['filters'], $data['force']);
    }
816173
public static function fromJson($json)
    {
        $object = json_decode($json);

        $sale = new Sale();
        $sale->populate($object);

        return $sale;
    }
1244844
public static function parseJSON($json) 
    {
        if (function_exists('json_decode')) {
            $return = json_decode(trim($json), true);
            // json_decode and UTF8 issues
            if (isset($return)) {
                return $return;
            }
        }
        include_once 'Zend/Json/Decoder.php';
        return Zend_Json_Decoder::decode($json);
    }
372552
public static function fromJson(string $json): self
    {
        $input = json_decode($json, true);
        $data = reset($input);
        $locale = key($input);
        
        return new self($locale, $data);
    }