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;
    }