com.fasterxml.jackson.databind.ser.std

## Class ToStringSerializer

- java.lang.Object
- - com.fasterxml.jackson.databind.JsonSerializer<T>
  - - com.fasterxml.jackson.databind.ser.std.StdSerializer<Object>
    - - com.fasterxml.jackson.databind.ser.std.ToStringSerializerBase
      - - com.fasterxml.jackson.databind.ser.std.ToStringSerializer

All Implemented Interfaces:
  JsonFormatVisitable, SchemaAware, Serializable

    public class ToStringSerializer
    extends ToStringSerializerBase

Simple general purpose serializer, useful for any type for which `Object.toString()` returns the desired JSON value.

Since 2.10 extends `ToStringSerializerBase`

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer

`JsonSerializer.None`

### Field Summary

Fields
`static ToStringSerializer` `instance` Singleton instance to use.

### Fields inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer

`_handledType`

### Constructor Summary

Constructors
Constructor and Description
`ToStringSerializer()` Note: usually you should NOT create new instances, but instead use `instance` which is stateless and fully thread-safe.
`ToStringSerializer(Class<?> handledType)` Sometimes it may actually make sense to retain actual handled type.

### Method Summary

All Methods Instance Methods Concrete Methods
`String` `valueToString(Object value)`

### Methods inherited from class com.fasterxml.jackson.databind.ser.std.ToStringSerializerBase

`acceptJsonFormatVisitor, getSchema, isEmpty, serialize, serializeWithType`

### Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer

`_neitherNull, _nonEmpty, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrow`

### Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer

`getDelegatee, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterId, withIgnoredProperties`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### instance

    public static final ToStringSerializer instance

Singleton instance to use.

### Constructor Detail

#### ToStringSerializer

    public ToStringSerializer()

Note: usually you should NOT create new instances, but instead use `instance` which is stateless and fully thread-safe. However, there are cases where constructor is needed; for example, when using explicit serializer annotations like `JsonSerialize.using()`.

#### ToStringSerializer

    public ToStringSerializer(Class<?> handledType)

Sometimes it may actually make sense to retain actual handled type.

Since:
  2.5

### Method Detail

#### valueToString

    public final String valueToString(Object value)

Specified by:
  `valueToString` in class `ToStringSerializerBase`