Skip to content

Add support for Redis JSON - #3390

Closed
Dgramada wants to merge 12 commits into
spring-projects:mainfrom
Dgramada:feature/json-integration
Closed

Dgramada wants to merge 12 commits into
spring-projects:mainfrom
Dgramada:feature/json-integration

Conversation

@Dgramada

@Dgramada Dgramada commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

This is a follow up pull request to #3327 that handles the new JSON API for Spring Data Redis.
It builds upon the command layer from the referenced PR and adds API for the template layer.

Notes:

  • BoundJsonOperations is not included yet. Once a version of JsonOperations is approved, the bound operations can be included in this branch.
  • RedisJsonTemplate initially felt like a good idea. It creates a separation of concerns, which is nice because the new JSON API does not pair well with a specific V type unlike the other data types in RedisTemplate. However, RedisJsonTemplate feels a little off and maybe a more elegant solution could be derived. It feels more like a configuration class. Maybe we could rename it to RedisJsonConfig. This would also promote developers to inject JsonOperations directly.
  • RedisJsonSerializer does not extend RedisSerializer, due to it bringing a lot of functionality that doesn't add any value to the JSON serialization. Furthermore, keeping them separate gives separation of concerns. Also Jedis and Lettuce do not provide byte[] APIs for the JSON commands in Redis, thus making RedisSerializer incompatible.

  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

Dgramada added 2 commits June 23, 2026 12:35
Signed-off-by: Yordan Tsintsov <[email protected]>
Signed-off-by: Yordan Tsintsov <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 29, 2026
@Dgramada
Dgramada marked this pull request as ready for review June 30, 2026 11:43
@mp911de mp911de changed the title Feature/json integration Add support for Redis JSON Jul 1, 2026
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 1, 2026

@mp911de mp911de left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's an initial round of review feedback.

Dgramada added 5 commits July 8, 2026 16:19
Signed-off-by: Yordan Tsintsov <[email protected]>
Signed-off-by: Yordan Tsintsov <[email protected]>
Signed-off-by: Yordan Tsintsov <[email protected]>
Signed-off-by: Yordan Tsintsov <[email protected]>
@mp911de mp911de self-assigned this Jul 29, 2026
@mp911de
mp911de force-pushed the main branch 2 times, most recently from e0163c7 to 5e76bfb Compare August 5, 2026 14:13
@mhalbritter

mhalbritter commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Just a note from my side:

RedisJsonCommands has no commands for JSON.OBJKEYS, JSON.OBJLEN, JSON.NUMINCRBY or JSON.ARRPOP. This could be something worth considering to add in the future, after this PR has been merged.

@Dgramada

Dgramada commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Hi @mhalbritter. Thank you for pointing this out. The commands were omitted on purpose because of some issues with the Jedis driver. We are planning on improving the Jedis JSON API and possibly adding the leftover commands once Jedis releases the API improvements.

mp911de added a commit that referenced this pull request Aug 12, 2026
Fix inconsistencies, bugs, documentation, move types around, make specs immutable.
Fix DataType literal. Refine exception guards. Enable CI for Valkey (bare, without JSON).

Remove StringRedisJsonTemplate for now, update docs, introduce fluent delete/unlink API for key removal.

See #3390
@mp911de mp911de added this to the 4.2.0-M1 (2026.1.0) milestone Aug 12, 2026
@mp911de

mp911de commented Aug 12, 2026

Copy link
Copy Markdown
Member

Thank you for your contribution. That's merged and polished now.

mp911de added a commit that referenced this pull request Aug 12, 2026
Fix inconsistencies, bugs, documentation, move types around, make specs immutable.
Fix DataType literal. Refine exception guards. Enable CI for Valkey (bare, without JSON).

Remove StringRedisJsonTemplate for now, update docs, introduce fluent delete/unlink API for key removal.

See #3390
mp911de added a commit that referenced this pull request Aug 12, 2026
Fix inconsistencies, bugs, documentation, move types around, make specs immutable.
Fix DataType literal. Refine exception guards. Enable CI for Valkey (bare, without JSON).

Remove StringRedisJsonTemplate for now, update docs, introduce fluent delete/unlink API for key removal.

See #3390
andy-stark-redis added a commit to redis/docs that referenced this pull request Nov 24, 2026
Document the new template-layer JSON API from the in-progress SDR PR
spring-projects/spring-data-redis#3390 ahead of its release. The page
lives under content/integrate/spring-framework-cache/, which despite the
directory name is the Spring Data Redis section (LinkTitle "Spring Data
Redis"), alongside the cache and geo-failover recipes.

The non-obvious call: no per-client split. RedisJsonTemplate/JsonOperations
is client-agnostic and identical whether Jedis or Lettuce backs the
connection — the clients diverge only in internal converters/path types
below the API surface, with full feature parity. So one set of examples
serves both. Examples are inline java (not runnable TCE snippets) because
the feature isn't in the client example repos yet, and a bannerText flags
the API as unreleased and subject to change.

Learned: SDR JSON template API is unified across Jedis/Lettuce; docs based on an unmerged PR
Directive: keep the JSON examples client-agnostic — do not split into Jedis vs Lettuce variants
Recheck: when spring-data-redis#3390 merges and ships — re-verify method signatures, bean/serializer wiring, and convert examples to runnable TCE doctests
Gaps: code examples untested; signatures and API shape read from an in-progress, still-reviewed diff
Ticket: DOC-6829
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants