Utility function used to create a new instance from a JSON string.

@param array $json a PHP array which contains the result of a 'json_decode' execution.

@return \Gomoob\Pushwoosh\Model\Response\SetTagsResponse the resulting instance.
505080
public static function create(array $json)
    {
        $setTagsResponse = new SetTagsResponse();
        $setTagsResponse->setStatusCode($json['status_code']);
        $setTagsResponse->setStatusMessage($json['status_message']);

        return $setTagsResponse;
    }
869233
public static function create($json)
    {
        $entity = json_decode($json);

        if (is_null($entity)) {
            throw new \InvalidArgumentException("Invalid JSON", 1);
        }

        if (!isset($entity->object) || $entity->object != 'event') {
            throw new \InvalidArgumentException("Entity is not an event", 2);
        }

        $modelClass = self::getModelClassFromEventType($entity->type);

        return new $modelClass($json);
    }
1318592
public static function create(array $json)
    {
        $deleteMessageResponse = new DeleteMessageResponse();
        $deleteMessageResponse->setStatusCode($json['status_code']);
        $deleteMessageResponse->setStatusMessage($json['status_message']);

        return $deleteMessageResponse;
    }
1097361
public static function fromJson($json, int $options = 0)
    {
        $result = json_decode($json, true, 512, $options);
        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new JsonDecodeException(json_last_error_msg());
        }

        return new static(\is_array($result) ? $result : []);
    }
816173
public static function fromJson($json)
    {
        $object = json_decode($json);

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

        return $sale;
    }
1264277
public static function create(array $json)
    {
        $pushStatResponse = new PushStatResponse();
        $pushStatResponse->setStatusCode($json['status_code']);
        $pushStatResponse->setStatusMessage($json['status_message']);

        return $pushStatResponse;
    }
1132630
protected function parse_json( $json ) {

		$data = json_decode( $json, true );

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

		return $data;
	}
411355
public static function parse($json)
    {
        $json = json_decode($json);

        if (!isset($json->status)) {
            throw new JSendParseException('Could not parse data; required element \'status\' missing.');
        }

        $instance = new static($json->status);

        if (!isset($json->code)) {
            $json->code = 200;
        }
        $instance->setCode($json->code);

        if ($instance->isError()) {
            if (!isset($json->message)) {
                throw new JSendParseException('Could not parse data; required element \'message\' missing.');
            }
            $instance->setMessage($json->message);
        }

        if ($instance->isSuccess() || $instance->isFail()) {
            if (!isset($json->data)) {
                throw new JSendParseException('Could not parse data; required element \'data\' missing.');
            }
            $instance->setData($json->data);
        } else {
            if ($instance->isError()) {
                if (isset($json->data)) {
                    $instance->setData($json->data);
                }
            }
        }

        return $instance;
    }
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;
		}
	}
12021
public static function json2arr($json)
    {
        $result = json_decode($json, true);
        if (empty($result)) {
            throw new InvalidResponseException('invalid response.', '0');
        }
        if (!empty($result['errcode'])) {
            throw new InvalidResponseException($result['errmsg'], $result['errcode'], $result);
        }
        return $result;
    }
1336845
public static function jsonDeserialize( $json ) {
		return new self(
			$json['id'],
			$json['type'],
			$json['action'],
			$json['timestamp'],
			$json['user'],
			PageIdentifier::jsonDeserialize( $json['pageidentifier'] ),
			$json['comment'],
			$json['details']
		);
	}
1203969
protected function unsupportedActionResponse($json)
    {
        $error = new Error('Unsupported Action', json_decode($json));

        return $this->createResponse(new UnsupportedAction([$error]));
    }
743808
private function setJsonData(?string $json): self
    {
        $this->updatePropertyValue(
            JsonDataFieldInterface::PROP_JSON_DATA,
            $json
        );

        return $this;
    }
1321592
private function decodeJSON($json)
    {
        $query = json_decode($json);

        if (json_last_error()) {
            throw new QBParseException('JSON parsing threw an error: '.json_last_error_msg());
        }

        if (!is_object($query)) {
            throw new QBParseException('The query is not valid JSON');
        }

        return $query;
    }
553902
public static function createFromJsonResponse($jsonString)
    {
        $data = json_decode($jsonString, true);

        $sourceImages = array_map(function ($sourceImage) {
            return SourceImage::createFromDecodedJsonResponse($sourceImage);
        }, $data['items']);

        $total = isset($data['total']) ? $data['total'] : 0;
        $links = isset($data['links']) ? $data['links'] : [];
        $cursor = isset($data['cursor']) ? $data['cursor'] : null;

        return new self($sourceImages, $total, $links, $cursor);
    }
953623
public static function create(array $json)
    {
        $unregisterDeviceResponse = new UnregisterDeviceResponse();
        $unregisterDeviceResponse->setStatusCode($json['status_code']);
        $unregisterDeviceResponse->setStatusMessage($json['status_message']);

        return $unregisterDeviceResponse;
    }
624402
private function decode($json)
  {
    $decodedResult = json_decode($json, true);
    if (JSON_ERROR_NONE != json_last_error()) {
      throw new ResponseDecodeException('JSON error: '.json_last_error_msg());
    }

    return $decodedResult;
  }