/*
Object should be based on what is set as KEY_SERIALIZER_CLASS_CONFIG, We are assuming value is of String type
501680
protected ProducerRecord<Object, Object> createKafkaMessage(Object pRequestString, Map<String, String> headers) {
        if (headers == null)
            recordProps = getRecordProps();
        else {
            recordProps = new Properties();
            recordProps.putAll(headers);
            String partition = (String)recordProps.get(RECORD_PARTITION);
            Integer partitionInt = new Integer(partition);
            recordProps.replace(RECORD_PARTITION, partitionInt);
        }
        return  new ProducerRecord<>((String)recordProps.get(KAFKA_TOPIC_NAME), (Integer)recordProps.get(RECORD_PARTITION), recordProps.get(RECORD_KEY), pRequestString);
    }
283367
private Object convertStringToNearestObjectType(String value) {
    switch (value) {
      case "true":
        return true;
      case "false":
        return false;
      default: {
        if (NumberUtils.isParsable(value)) {
          return Integer.parseInt(value);
        }
        return value;
      }
    }
  }
74968
private void determineValueType(Object value){
		if (value instanceof Integer){
			this.valueEncoder.valueType = INTEGER;
			this.valueEncoder.valueBytes = ByteBuffer.allocate(4).putInt((Integer)value).array();
		}
		else if (value instanceof Long) {
			this.valueEncoder.valueType = LONG;
			this.valueEncoder.valueBytes = ByteBuffer.allocate(8).putLong((Long)value).array();
		}
		else if (value == null){
			this.valueEncoder.valueType = NULL;
		}
		else {
			ObjectOutputStream oos = null;
			try {
				ByteArrayOutputStream bos = new ByteArrayOutputStream();
				oos = new ObjectOutputStream(bos);
				oos.writeObject(value);
				this.valueEncoder.valueType = OBJECT;
				this.valueEncoder.valueBytes = bos.toByteArray();
			} catch (Exception e) {
				throw new IllegalStateException("Failed to serialize value: " + value, e);
			} finally {
				try {
					if (oos != null){
						oos.close();
					}
				} catch (Exception e2) {/*ignore*/}
			}
		}
	}
597861
public boolean isKeySerializer( JType type ) {
        return null != type.isClass() && type.isClass().isAssignableTo( keySerializerType );
    }
179381
private void validateString(Type type) throws SerializerException {
        if (null == type || !String.class.equals(TypeToken.of(type).getRawType())) {
            throw new SerializerException("String serializer is able to work only with data types assignable from java.lang.String");
        }
    }
966513
void writeObjectAsString(Object value, Class<?> effectiveType) throws IOException {
        String converted = settings.getConverter().convertToString(effectiveType, value);
        if (converted == null) {
            throw new IllegalArgumentException("Unable to write because converter returned a null string: " + value);
        }
        output.writeString(converted);
    }
702279
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
        serial_tuples = [
            (
                self.key_prop.serialize(key, **kwargs),
                self.value_prop.serialize(val, **kwargs)
            )
            for key, val in iteritems(value)
        ]
        try:
            serial_dict = {key: val for key, val in serial_tuples}
        except TypeError as err:
            raise TypeError('Dictionary property {} cannot be serialized - '
                            'keys contain {}'.format(self.name, err))
        return serial_dict
387622
function ( value ) {
            var result = false;
    
            switch ( this.type(value) ) {
                case 'Object':
                    result = true;
                    for ( var key in value ) {
                        result = false;
                        break;
                    }
                    break;
                case 'Array':
                    result = value.length === 0;
                    break;
                case 'Null':
                    result = true;
                    break;
                case 'Undefined':
                    result = true;
                    break;
                case 'String':
                    result = '' === value;
                    break;
            }
    
            return result;
        }
196880
String _serialize(Object o) {
        String body = null;
            try {
                body = new String(serialize(o));
            } catch (IOException e) {
                throw new ServiceException(ErrorCode.HTTP_CLIENT_ERROR,
                        ErrorCode.HTTP_CLIENT_ERROR.getMessageTemplate(),
                        "serialize failed.");
            }
        return body;
    }
767272
function serialize(value) {
  if (Array.isArray(value) === true) {
    return serializeArray(value);
  }
  if (isObject(value) === false) {
    return serializePrimitive(value);
  }
  return serializeObject(value);
}
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
        )
1200872
private static String getJsonValueAsString(JsonValue value) {
        return (value != null && value.getValueType() == ValueType.STRING) ? ((JsonString) value).getString() : null;
    }
368137
function jsonStringifyIfObject (value) {
  if (!(value instanceof Object)) {
    return value;
  }
  return JSON.stringify(value, options.jsonStringifyReplacer,
    options.jsonStringifySpaces);
}
53682
function isString(value) {
    return typeof value == 'string' ||
      value && typeof value == 'object' && toString.call(value) == stringClass || false;
  }
986576
function parseQueryStringItemValue(key, value) {
  if (Array.isArray(value)) {
    // deduplicate and simplify arrays
    value = value.filter((v, idx) => value.indexOf(v) === idx);
    if (value.length === 1) value = value[0];
  } else if (value.indexOf(':') > 0) {
    value = value.split(',').reduce((result, pair) => {
      const parts = pair.split(':');
      result[parts[0]] = parseQueryStringItemValue(key, parts[1]);
      return result;
    }, {});
  } else if (value.indexOf(',') > 0) {
    value = value.split(',').map(v => {
      return parseQueryStringItemValue(key, v);
    });
  } else if (value.toLowerCase() === 'true' || value.toLowerCase() === 'false') {
    value = value.toLowerCase() === 'true';
  } else if (!Number.isNaN(value) && !STRING_OPTIONS.has(key)) {
    const numericValue = parseFloat(value);
    if (!Number.isNaN(numericValue)) {
      value = parseFloat(value);
    }
  }

  return value;
}
581486
def convert(self, key, value):
        """"""
        if key not in self._dtypes:
            self.read_types()
            if key not in self._dtypes:
                name = utils.name(value)
                serializer = utils.serializer(name)
                deserializer = utils.deserializer(name)
                self._dtypes[key] = (name, serializer, deserializer)
                with self.db:
                    self.db.execute("replace into value_types (key, value_type) values (?, ?)", (key, name))
        return self._dtypes[key][1](value)
227042
public void put(String key, Object object, boolean serialize){
        if(serialize)
            put(key,gson.toJson(object));
        else
            put(key,object);
    }