public function marshall(ServletSessionInterface $servletSession)
    {

        // create the stdClass (that can easy be transformed into an JSON object)
        $sessionData = array();

        // copy the values to the stdClass
        $sessionData[StandardSessionMarshaller::ID] = $servletSession->getId();
        $sessionData[StandardSessionMarshaller::NAME] = $servletSession->getName();
        $sessionData[StandardSessionMarshaller::LIFETIME] = $servletSession->getLifetime();
        $sessionData[StandardSessionMarshaller::MAXIMUM_AGE] = $servletSession->getMaximumAge();
        $sessionData[StandardSessionMarshaller::DOMAIN] = $servletSession->getDomain();
        $sessionData[StandardSessionMarshaller::PATH] = $servletSession->getPath();
        $sessionData[StandardSessionMarshaller::SECURE] = $servletSession->isSecure();
        $sessionData[StandardSessionMarshaller::HTTP_ONLY] = $servletSession->isHttpOnly();
        $sessionData[StandardSessionMarshaller::LAST_ACTIVITY_TIMESTAMP] = $servletSession->getLastActivityTimestamp();

        // initialize the array for the session data
        $sessionData[StandardSessionMarshaller::DATA] = array();

        // append the session data
        foreach ($servletSession->data as $key => $value) {
            $sessionData[StandardSessionMarshaller::DATA][$key] = serialize($value);
        }

        // JSON encode the session instance
        $encodedSession = json_encode($sessionData);

        // query whether or not the session data has been decoded successfully
        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new SessionDataNotReadableException(json_last_error_msg());
        }

        // return the JSON encoded session data
        return $encodedSession;
    }