Sets the JSON value at the specified path in the key. Creates the key if it doesn’t exist.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/upstash/redis-js/llms.txt
Use this file to discover all available pages before exploring further.
Usage
Arguments
The key to store the JSON document
JSONPath expression specifying where to set the value in the JSON document. Use
$ to set the entire document.The JSON value to set. Can be a number, string, boolean, object, or array.
Optional conditional set options
Response
Returns
"OK" if the value was set successfully, or null if the condition (NX/XX) was not met.Examples
Set entire JSON document
Set specific field
Set nested value
Set array element
Conditional set - only if path doesn’t exist (NX)
Conditional set - only if path exists (XX)
JSONPath Syntax
$- Root element (sets entire document)$.field- Set a specific field$.field[0]- Set array element at index$.nested.field- Set nested field
See Also
- JSON.GET - Get JSON values
- JSON.DEL - Delete JSON values
- Redis JSON.SET documentation