feature: auto create path for json.set by emreyalvac · Pull Request #1611 · RedisJSON/RedisJSON · GitHub
Skip to content

feature: auto create path for json.set#1611

Open
emreyalvac wants to merge 3 commits into
RedisJSON:masterfrom
emreyalvac:feature/auto-create-path
Open

feature: auto create path for json.set#1611
emreyalvac wants to merge 3 commits into
RedisJSON:masterfrom
emreyalvac:feature/auto-create-path

Conversation

@emreyalvac

@emreyalvac emreyalvac commented Jun 26, 2026

Copy link
Copy Markdown

This PR adds an auto-create path feature to JSON.SET to handle missing nested paths automatically. Instead of throwing an error, it now creates the intermediate structures on the fly.

#27 #1388

@CLAassistant

CLAassistant commented Jun 26, 2026

Copy link
Copy Markdown

@LiorKogan

LiorKogan commented Jun 27, 2026

Copy link
Copy Markdown
Member

@emreyalvac, thank you. This is a very welcome addition, but there are some important points to consider:

  1. It could be a breaking change for users who rely on the current replies.
  2. The behavior should be similar for other write commands, not specific to JSON.SET.
  3. Is it just about creating new keys, or also sub-paths for existing keys?

The best way to address 1. is probably to add a new configuration parameter (RedisJSON currently has none) that users can explicitly enable.

We also need a clear formal definition of the new behavior. JSONPath is tricky. Consider the following examples:

  • JSON.SET j "$['a','b'].c" 1
  • JSON.SET j "$[2:5:2].c" 1
  • JSON.SET j "$..*.a 1
  • JSON.SET j "$..[0]" [0]

@emreyalvac

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants