Class JsonToObjectTransformer

All Implemented Interfaces:
Aware, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, InitializingBean, ApplicationContextAware, ExpressionCapable, NamedComponent, GenericTransformer<Message<?>,​Message<?>>, Transformer

public class JsonToObjectTransformer
extends AbstractTransformer
implements BeanClassLoaderAware
Transformer implementation that converts a JSON string payload into an instance of the provided target Class. By default this transformer uses JsonObjectMapperProvider factory to get an instance of Jackson JSON-processor if jackson-databind lib is present on the classpath. Any other JsonObjectMapper implementation can be provided.

Since version 3.0, you can omit the target class and the target type can be determined by the JsonHeaders type entries - including the contents of a one-level container or map type.

The type headers can be classes or fully-qualified class names.

Since version 5.2.6, a SpEL expression option is provided to let to build a target ResolvableType somehow externally.

Since:
2.0
Author:
Mark Fisher, Artem Bilan
See Also:
JsonObjectMapper, JsonObjectMapperProvider, ResolvableType