returns mapping typed serialized `value`.
193896
def dumps(cls, value):
    ''''''
    if not hasattr(value, '__getitem__') or not hasattr(value, 'iteritems'):
      value = {cls.sentinel: value}
    return value
1272425
def serialize(self, value, **kwargs):
        
        kwargs.update({'include_class': kwargs.get('include_class', True)})
        if self.serializer is not None:
            return self.serializer(value, **kwargs)
        if value is None:
            return None
        for prop in self.props:
            try:
                prop.validate(None, value)
            except GENERIC_ERRORS:
                continue
            return prop.serialize(value, **kwargs)
        return self.to_json(value, **kwargs)
816604
function mapValueCast (value) {
      index++
      parameters.push(inputValue(value))

      let cast = ''

      if (Buffer.isBuffer(value))
        cast = '::bytea'
      else if (typeof value === 'number' && value % 1 === 0)
        cast = '::int'

      return `$${index}${cast}`
    }
1232437
def to_json(value, **kwargs):
        
        serial_dict = {
            key: (
                val.serialize(**kwargs) if isinstance(val, HasProperties)
                else val
            )
            for key, val in iteritems(value)
        }
        return serial_dict
983659
public function serialize($value) {
        $filters = $this->getFilters();
        for ($i = count($filters) - 1; $i >= 0; --$i) {
            $value = $filters[$i]->fromValue($value);
        }
        return $this->toData($value);
    }
547790
def from_string(self, serialized):
        
        self._warn_deprecated_outside_JSONField()
        value = yaml.safe_load(serialized)
        return self.enforce_type(value)
1338137
public static function serializeValue($value)
    {
        if ($value instanceof JsonSerializable || $value instanceof \JsonSerializable) {
            return $value->jsonSerialize();
        }

        if (is_object($value)) {
            foreach (get_object_vars($value) as $nestedKey => $nestedValue) {
                $value->{$nestedKey} = self::serializeValue($nestedValue);
            }

            return $value;
        }

        if (is_array($value)) {
            foreach ($value as &$nestedValue) {
                $nestedValue = self::serializeValue($nestedValue);
            }

            return $value;
        }

        if ($value instanceof DateTime || $value instanceof \DateTimeInterface) {
            throw new DomainException('Please wrap your DateTime objects with Aplazame\Serializer\Date::fromDateTime');
        }

        if (is_float($value)) {
            throw new DomainException('Please wrap your float values with Aplazame\Serializer\Decimal::fromFloat');
        }

        return $value;
    }
1351217
def deserialize(type_, value=None, **kwargs):
    ''''''
    if not isinstance(type_, str):
        return type_
    des = deserializer(type_, **kwargs)
    if value is None:
        return des
    return des(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;
    }
382831
public ByteBuffer getSerializedValue(ByteBuffer serializedMap, ByteBuffer serializedKey, AbstractType keyType)
    {
        try
        {
            ByteBuffer input = serializedMap.duplicate();
            int n = readCollectionSize(input, Server.VERSION_3);
            for (int i = 0; i < n; i++)
            {
                ByteBuffer kbb = readValue(input, Server.VERSION_3);
                ByteBuffer vbb = readValue(input, Server.VERSION_3);
                int comparison = keyType.compare(kbb, serializedKey);
                if (comparison == 0)
                    return vbb;
                else if (comparison > 0)
                    // since the map is in sorted order, we know we've gone too far and the element doesn't exist
                    return null;
            }
            return null;
        }
        catch (BufferUnderflowException e)
        {
            throw new MarshalException("Not enough bytes to read a map");
        }
    }
754036
def _deserialize(self, value, attr, data):
        """"""
        value = super(TrimmedString, self)._deserialize(value, attr, data)
        return value.strip()
1252928
def serialize(
            self,
            value,  # type: Any
            state  # type: _ProcessorState
    ):
        # type: (...) -> ET.Element
        """"""
        xml_value = _hooks_apply_before_serialize(self._hooks, state, value)
        return self._processor.serialize(xml_value, state)
196359
def to_serializable_value(self):
        
        return {
            name: field.to_serializable_value()
            for name, field in self.value.__dict__.items()
            if isinstance(field, Field) and self.value
        }
1369779
public function serialize($value)
    {
        $this->noMappingGuard();

        if (\is_array($value) && !empty($value[Serializer::MAP_TYPE])) {
            $data = $this->serializedArray($value);
        } else {
            $data = $this->serializeObject($value);
        }

        return \json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
    }
195758
public static String serialize(Object value) {
        if (value instanceof String) {
            return (String) value;
        } else if (value instanceof byte[]) {
            return new String((byte[]) value);
        }
1370401
function serialize(value, indent) {
    "use strict";
    if (isArray(value)) {
        value = value.map(function _map(prop) {
            return isFunction(prop) ? prop.toString().replace(/\s{2,}/, '') : prop;
        });
    }
    return JSON.stringify(value, null, indent);
}
999288
@JsonProperty
    public Serializable getSerializable()
    {
        return new Serializable(type, value == null ? null : Utils.nativeValueToBlock(type, value));
    }