pre-serialize value
965949
def serialize(self, value, **kwargs):
        
        if self._serialize is not None:
            return self._serialize(value, **kwargs)
        else:
            return value
277834
@Override
  public <T> ByteBuffer serialize(final Serializer<T> serializer, final T value)
    throws IOException {
    try (final BytesSerialWriter writer = writeBytes()) {
      serializer.serialize(writer, value);
      return writer.toByteBuffer();
    }
  }
360832
function serialize(obj) {
  var params = [],
    encodedBrackets = encodeURIComponent('[]');

  _.forOwn(obj, function(value, key) {
    if (typeof value === 'string' ||
      typeof value === 'number' ||
      typeof value === 'boolean') {
      params.push(key + '=' + encodeURIComponent(value));
    } else if (typeof value === 'object' && Array.isArray(value)) {
      params.push(value.map(function(param) {
        return key + encodedBrackets + '=' + encodeURIComponent(param);
      }).join('&'));
    }
  });

  return params.join('&');
}
1028320
@Override
	protected void unserializeFrom(RawDataBuffer in)
    {
    	super.unserializeFrom(in);
    	browserId = new IntegerID(in.readInt());   
    }
1030408
public void serializePrimitive(S rec, String fieldName, boolean value) {
        serializePrimitive(rec, fieldName, Boolean.valueOf(value));
    }
150969
private String _serialize(Object object, Set<Object> done) throws ConverterException {
	String rtn;
	deep++;
	// NULL
	if (object == null) {
	    rtn = goIn() + "<null/>";
	    deep--;
	    return rtn;
	}
	// String
	if (object instanceof String) {
	    rtn = goIn() + "<string>" + XMLUtil.escapeXMLString(object.toString()) + "</string>";
	    deep--;
	    return rtn;
	}
	// Number
	if (object instanceof Number) {
	    rtn = goIn() + "<number>" + ((Number) object).doubleValue() + "</number>";
	    deep--;
	    return rtn;
	}
	// Boolean
	if (object instanceof Boolean) {
	    rtn = goIn() + "<boolean value=" + del + ((Boolean) object).booleanValue() + del + "/>";
	    deep--;
	    return rtn;
	}
	// DateTime
	if (object instanceof DateTime) {
	    rtn = _serializeDateTime((DateTime) object);
	    deep--;
	    return rtn;
	}
	// Date
	if (object instanceof Date) {
	    rtn = _serializeDate((Date) object);
	    deep--;
	    return rtn;
	}
	// Date
	if (Decision.isCastableToBinary(object, false)) {
	    rtn = _serializeBinary(Caster.toBinary(object, null));
	    deep--;
	    return rtn;
	}

	Object raw = LazyConverter.toRaw(object);
	if (done.contains(raw)) {
	    rtn = goIn() + "<null/>";
	    deep--;
	    return rtn;
	}

	done.add(raw);
	try {
	    // Component
	    if (object instanceof Component) {
		rtn = _serializeComponent((Component) object, done);
		deep--;
		return rtn;
	    }
	    // Struct
	    if (object instanceof Struct) {
		rtn = _serializeStruct((Struct) object, done);
		deep--;
		return rtn;
	    }
	    // Map
	    if (object instanceof Map) {
		rtn = _serializeMap((Map) object, done);
		deep--;
		return rtn;
	    }
	    // Array
	    if (object instanceof Array) {
		rtn = _serializeArray((Array) object, done);
		deep--;
		return rtn;
	    }
	    // List
	    if (object instanceof List) {
		rtn = _serializeList((List) object, done);
		deep--;
		return rtn;
	    }
	    // Query
	    if (object instanceof Query) {
		rtn = _serializeQuery((Query) object, done);
		deep--;
		return rtn;
	    }
	}
	finally {
	    done.remove(raw);
	}
	// Others
	rtn = "<struct type=" + del + "L" + object.getClass().getName() + ";" + del + "></struct>";
	deep--;
	return rtn;
    }
957934
def quote(cls, value):
        
        if cls.serialization_method is not None:
            value = cls.serialization_method.dumps(value)
        if cls.quote_base64:
            value = b''.join(base64.b64encode(value).splitlines()).strip()
        return value
90144
public void serializePrimitive(S rec, String fieldName, int value) {
        serializePrimitive(rec, fieldName, Integer.valueOf(value));
    }
434371
async def serialize(self, value, native=False):
        '''
        
        '''
        if native:
            return self.to_python(value)
        return self.to_data(value)
1152832
function handleFieldValue (value) {
      if (!(value instanceof Buffer || typeof value === 'string')) {
        if (is(value).a(Object)) {
          if (value instanceof fs.FileReadStream) {
            return value
          } else {
            return Unirest.serializers.json(value)
          }
        } else {
          return value.toString()
        }
      } else return value
    }
716196
private String _serialize(Object object, Map<Object, String> done) throws ConverterException {

	type = "OBJECT";

	String rtn;
	deep++;
	// NULL
	if (object == null) {
	    rtn = goIn() + "";
	    deep--;
	    type = "NULL";
	    return rtn;
	}
	// String
	if (object instanceof String) {
	    rtn = goIn() + XMLUtil.escapeXMLString(object.toString());
	    deep--;
	    type = "STRING";
	    return rtn;
	}
	// Number
	if (object instanceof Number) {
	    rtn = goIn() + ((Number) object).doubleValue();
	    deep--;
	    type = "NUMBER";
	    return rtn;
	}
	// Boolean
	if (object instanceof Boolean) {
	    rtn = goIn() + ((Boolean) object).booleanValue();
	    deep--;
	    type = "BOOLEAN";
	    return rtn;
	}
	// DateTime
	if (object instanceof DateTime) {
	    rtn = _serializeDateTime((DateTime) object);
	    deep--;
	    type = "DATE";
	    return rtn;
	}
	// Date
	if (object instanceof Date) {
	    rtn = _serializeDate((Date) object);
	    deep--;
	    type = "DATE";
	    return rtn;
	}

	Object raw = LazyConverter.toRaw(object);
	String strId = done.get(raw);
	if (strId != null) {
	    rtn = goIn() + "<REF id=\"" + strId + "\"\\>";
	    deep--;
	    type = "NULL";
	    return rtn;
	}
	strId = Caster.toString(++this.id);
	done.put(raw, strId);
	try {
	    // Component
	    if (object instanceof Component) {
		rtn = _serializeComponent((Component) object, done);
		deep--;
		return rtn;
	    }
	    // Struct
	    if (object instanceof Struct) {
		rtn = _serializeStruct((Struct) object, done, strId);
		deep--;
		return rtn;
	    }
	    // Map
	    if (object instanceof Map) {
		rtn = _serializeMap((Map) object, done);
		deep--;
		return rtn;
	    }
	    // Array
	    if (object instanceof Array) {
		rtn = _serializeArray((Array) object, done, strId);
		deep--;
		return rtn;
	    }
	    // List
	    if (object instanceof List) {
		rtn = _serializeList((List) object, done, strId);
		deep--;
		return rtn;
	    }
	    // Query
	    if (object instanceof Query) {
		rtn = _serializeQuery((Query) object, done, strId);
		deep--;
		return rtn;
	    }
	}
	finally {
	    done.remove(raw);
	}
	// Others
	rtn = "<STRUCT ID=\"" + strId + "\" TYPE=\"" + Caster.toTypeName(object) + "\"></STRUCT>";
	deep--;
	return rtn;
    }
140956
def _serialize(self, value, attr, obj, **kwargs):
        """"""
        ret = self._validated(value)
        return (
            self._to_string(ret)
            if (self.as_string and ret not in (None, missing_))
            else ret
        )
488618
function (key, instance, serializer) {
    var value = serializer.serialize(instance);
    if (key !== undefined) {
        return "\"" + key + "\":" + value;
    }
    else {
        return value;
    }
}
1012022
def _serialize(self, convert_to_key_and_value, ignore_missing=False):
        

        serialized = {}
        properties = self._get_property_names(self)

        def get_property_detail(name):
            p = [p for p in self._property_details if p.name == name]
            return None if len(p) == 0 else p[0]

        for p in properties:
            pd = get_property_detail(p)
            value = self._property_to_field(p, pd)
            field_name = p if not pd else pd.to_field_name()

            if value is None or (ignore_missing and not value) or (pd and pd.unsent):
                continue
            else:
                key, value = convert_to_key_and_value(field_name, value, pd)
                if key:
                    serialized[key] = value

        return serialized
274905
@Override
	protected void unserializeBodyFrom(RawDataBuffer in)
    {
        int size = in.readInt();
        body.ensureCapacity(size);
        for (int n = 0 ; n < size ; n++)
        {
            Object value = in.readGeneric();
            body.add(value);
        }
    }
1257477
def _serialize(self, value, attr, obj):
        """"""
        try:
            return super(DateString, self)._serialize(
                arrow.get(value).date(), attr, obj)
        except ParserError:
            return missing
684531
public void serializePrimitive(S rec, String fieldName, long value) {
        serializePrimitive(rec, fieldName, Long.valueOf(value));
    }