Class RedisJsonTemplate<K>

java.lang.Object
org.springframework.data.redis.core.RedisJsonTemplate<K>
Type Parameters:
K - the Redis key type.
All Implemented Interfaces:
JsonOperations<K>, RedisJsonOperations<K>

public class RedisJsonTemplate<K> extends Object implements RedisJsonOperations<K>
This is the central JSON entrypoint in the Redis core package for flexible JSON result consumption. It can be used directly for many data access purposes, supporting any kind of Redis JSON operation.

Typed entry points bound to a key allow configuring the command and running it by calling a terminal method returning the command result, for example:

operations.value("key").set("value");
operations.value("key").path("$..name").setIfAbsent("Doe");
operations.array("key").path("$.names").index(2).insert("John");

Person person = operations.value("key").get().as(Person.class);

JSON path expressions follow the RedisJSON version 2 path syntax. Unless specified otherwise, results are positionally correlated to matching paths: each element in the returned List corresponds to a matching path, with null indicating that the matched value has an incompatible JSON type.

Specification objects are immutable and can be used to build up complex queries.

Since:
4.2
Author:
Yordan Tsintsov, Mark Paluch, Moritz Halbritter
See Also: