Interface RedisJsonSerializer
- All Superinterfaces:
RedisSerializer<Object>
- All Known Implementing Classes:
GenericJackson2JsonRedisSerializer, GenericJacksonJsonRedisSerializer
RedisSerializer extension for converting Objects to and from their JSON byte[] representation.
A JSON serializer primarily adds convenient methods for deserializing JSON into typed objects.
- Since:
- 4.2
- Author:
- Yordan Tsintsov, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> @Nullable Tdeserialize(byte[] source, ParameterizedTypeReference<T> typeRef) Deserialize the givensourceinto an instance of the type described by aParameterizedTypeReference.deserialize(byte[] source, ResolvableType type) Deserialize the givensourceinto an instance of the type described byResolvableType.Methods inherited from interface RedisSerializer
canSerialize, deserialize, deserialize, getTargetType, serialize
-
Method Details
-
deserialize
default <T> @Nullable T deserialize(byte[] source, ParameterizedTypeReference<T> typeRef) throws SerializationException Deserialize the givensourceinto an instance of the type described by aParameterizedTypeReference. Use this variant for generic types such asList<Person>that cannot be expressed as aClass.- Type Parameters:
T- the target type.- Parameters:
source- the JSON representation to read.typeRef- reference describing the target type.- Returns:
- the deserialized object, or null if
sourceis empty or represents JSON null. - Throws:
SerializationException- if the JSON cannot be deserialized.
-
deserialize
Deserialize the givensourceinto an instance of the type described byResolvableType. Use this variant for generic types such asList<Person>that cannot be expressed as aClass.- Parameters:
source- the JSON representation to read.type- reference describing the target type.- Returns:
- the deserialized object, or null if
sourceis empty or represents JSON null. - Throws:
SerializationException- if the JSON cannot be deserialized.
-