Returns a serialized object
544992
def post(request):
    """"""
    data = request.POST or json.loads(request.body)['body']
    guid = data.get('guid', None)
    res = Result()

    if guid:
        obj = getObjectsFromGuids([guid,])[0]
        comment = Comment()
        comment.comment = data.get('comment', 'No comment')
        comment.user = request.user
        comment.user_name = request.user.get_full_name()
        comment.user_email = request.user.email
        comment.content_object = obj
        # For our purposes, we never have more than one site
        comment.site_id = 1
        comment.save()

        obj.comment_count += 1
        obj.save()

        emailComment(comment, obj, request)

        res.append(commentToJson(comment))

    return JsonResponse(res.asDict())
1033405
public static Object serializeAndDeserialize(Object o) throws IOException,
			ClassNotFoundException {
		ByteArrayOutputStream bytes = new ByteArrayOutputStream();
		ObjectOutputStream out = new ObjectOutputStream(bytes);
		try {
			out.writeObject(o);
		} finally {
			out.close();
		}

		ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(
				bytes.toByteArray()));
		try {
			Object result = in.readObject();
			return result;
		} finally {
			in.close();
		}
	}
25506
function serialize()
	{
		$propvals = array();
		$ro = new ReflectionObject($this);

		foreach ($ro->getProperties() as $rp )
		{
			$propname = $rp->getName();

			if (!in_array($propname,self::$NoCacheProperties))
			{
				if (method_exists($rp,"setAccessible"))
				{
					$rp->setAccessible(true);
					$propvals[$propname] = $rp->getValue($this);
				}
				elseif (!$rp->isPrivate())
				{
					// if < php 5.3 we can't serialize private vars
					$propvals[$propname] = $rp->getValue($this);
				}

			}
		}

		return serialize($propvals);
	}
776193
def to_json(self, *args, **kwargs):
        """"""
        return json.dumps(self.serialize(), *args, **kwargs)
522519
function serializeObject(obj) {
  var seen = [];

  return JSON.stringify(obj, function(key, val) {
    val = toJsonReplacer(key, val);
    if (isObject(val)) {

      if (seen.indexOf(val) >= 0) return '...';

      seen.push(val);
    }
    return val;
  });
}
237922
def deserialize(self, obj):
        """"""
        if obj['immutable']:
            return obj['value']
        else:
            guid = obj['value']
            if not guid in object_registry:
                instance = JSObject(self, guid)
                object_registry[guid] = instance
            return object_registry[guid]
434371
async def serialize(self, value, native=False):
        '''
        
        '''
        if native:
            return self.to_python(value)
        return self.to_data(value)
5750
def _serialize(self, value, attr, obj, **kwargs):
        """"""
        if value is None:
            return None

        return int(datetime_to_timestamp(value))
57958
def serialize(self):
        
        data = super(Note, self).serialize()
        data.update({
            "verb": "post",
            "object": {
                "objectType": self.object_type,
                "content": self.content,
            }
        })
        if self.display_name:
            data["object"]["displayName"] = self.display_name

        return data
1030816
private String getObjectInfoFromSerializedObject() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getObjectInfoFromSerializedObject");
        String oscDesc;
        byte[] data = new byte[0];
        try {
            data = objMsg.getSerializedObject();
            oscDesc = SerializedObjectInfoHelper.getObjectInfo(data);
        } catch (ObjectFailedToSerializeException e) {
            oscDesc = String.format("unserializable class: %s", e.getExceptionInserts()[0]);
        }
        final String result = String.format("%s: %d%n%s: %s", HEADER_PAYLOAD_SIZE, data.length, HEADER_PAYLOAD_OBJ, oscDesc);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getObjectInfoFromSerializedObject", result);
        return result;
    }
1212451
def serialize(self):
        """"""
        # Serialize fields to a dict
        data = {}
        for field_name in self:
            value = self._values.get(field_name)
            field = self.fields.get(field_name)
            if value is not None:
                if field.all:
                    value = [field.serialize(v) for v in value]
                else:
                    value = field.serialize(value)
            # Skip empty fields unless field.null
            if not field.null and ((field.all and value == []) or (not field.all and value in {None, ''})):
                continue
            data[field.name] = value
        return data
1314731
public void returnSerializationObject(SerializationObject object) {
		synchronized (ivListOfObjects) {
			if (ivListOfObjects.size() < MAXIMUM_NUM_OF_OBJECTS) {
				ivListOfObjects.add(object);
			}
		}
	}
88284
def serialize(obj):
    
    if isinstance(obj, list):
        return [serialize(o) for o in obj]
    return GenericSerializer(ModelProviderImpl()).serialize(obj)
865025
function serializeObject(value: mixed): mixed {
  if (typeof value === 'object' && value !== null) {
    if (typeof value.valueOf === 'function') {
      const valueOfResult = value.valueOf();
      if (typeof valueOfResult !== 'object') {
        return valueOfResult;
      }
    }
    if (typeof value.toJSON === 'function') {
      // $FlowFixMe(>=0.90.0)
      return value.toJSON();
    }
  }
  return value;
}
874452
private Serializer getSupportedSerializer(Object o) throws SerializerException {
        for (Serializer s : serializers) {
            if (s.canWrite(o)) {
                return s;
            }
        }
        throw new SerializerException("Unable to find serializer for object with type '" + o.getClass() + "'");
    }
652703
def serialize(obj, **options):
    '''
    
    '''

    try:
        if 'fp' in options:
            return salt.utils.json.dump(obj, _json_module=_json, **options)
        else:
            return salt.utils.json.dumps(obj, _json_module=_json, **options)
    except Exception as error:
        raise SerializationError(error)
861474
def _serializer(obj):
    '''
    
    '''
    import datetime
    if isinstance(obj, datetime.datetime):
        if obj.utcoffset() is not None:
            obj = obj - obj.utcoffset()
        return obj.__str__()
    return obj