{
  "id": "jmespath-custom-functions",
  "title": "JMESPath custom functions",
  "url": "https://redis.io/docs/latest/integrate/write-behind/reference/jmespath-custom-functions/",
  "summary": "JMESPath custom function reference",
  "tags": [
    "docs",
    "integrate",
    "rs",
    "rdi"
  ],
  "last_updated": "2026-04-01T08:10:08-05:00",
  "page_type": "content",
  "content_hash": "0cc0698b042571514d966343a080ac07b09748f215ab39815b55309df9b2a63a",
  "sections": [
    {
      "id": "content",
      "title": "Content",
      "role": "content",
      "text": "| Function             | Description                                                                                                                         | Example                                                                                                                                                                                                  | Comments                                                                                                                                                         |\n| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `base64_decode`      | Decodes a base64(RFC 4648) encoded string                                                                                           | Input: `{\"encoded\": \"SGVsbG8gV29ybGQh\"}` <br /> Expression: `base64_decode(encoded)` <br /> Output: `Hello World!`                                                                                       |                                                                                                                                                                  |\n| `capitalize`         | Capitalizes all the words in the string                                                                                             | Input: `{\"name\": \"john doe\"}` <br /> Expression: `capitalize(name)` <br /> Output: `John Doe`                                                                                                            |                                                                                                                                                                  |\n| `concat`             | Concatenates an array of variables or literals                                                                                      | Input: `{\"fname\": \"john\", \"lname\": \"doe\"}` <br /> Expression: `concat([fname, ' ' ,lname])` <br /> Output: `john doe`                                                                                    | This is equivalent to the more verbose built-in expression: `' '.join([fname,lname])`                                                                            |\n| `filter_entries`     | Filters entries in a dictionary (object) using the given JMESPath predicate                                                         | Input: `{ \"name\": \"John\", \"age\": 30, \"country\": \"US\", \"score\": 15}` <br /> Expression: `` filter_entries(@, `key == 'name' \\|\\| key == 'age'`)``<br /> Output:`{\"name\": \"John\", \"age\": 30 }`             |                                                                                                                                                                  |\n| `from_entries`       | Converts an array of objects with `key` and `value` properties into a single object                                                 | Input: `[{\"key\": \"name\", \"value\": \"John\"}, {\"key\": \"age\", \"value\": 30}, {\"key\": \"city\", \"value\": null}]` <br /> Expression: `from_entries(@)` <br /> Output: `{\"name\": \"John\", \"age\": 30, \"city\": null}` |                                                                                                                                                                  |\n| `hash`               | Calculates a hash using the `hash_name` hash function and returns its hexadecimal representation                                    | Input: `{\"some_str\": \"some_value\"}` <br /> Expression: `hash(some_str, &#96;sha1&#96;)` <br /> Output: `8c818171573b03feeae08b0b4ffeb6999e3afc05`                                                        | Supported algorithms: sha1 (default), sha256, md5, sha384, sha3_384, blake2b, sha512, sha3_224, sha224, sha3_256, sha3_512, blake2s                              |\n| `in`                 | Checks if an element matches any value in a list of values                                                                          | Input: `{\"el\": \"b\"}` <br /> Expression: `in(el, `[\"a\", \"b\", \"c\"]`)` <br /> Output: `True`                                                                                                                |                                                                                                                                                                  |\n| `left`               | Returns a specified number of characters from the start of a given text string                                                      | Input: `{\"greeting\": \"hello world!\"}` <br /> Expression: `left(greeting, `5`)` <br /> Output: `hello`                                                                                                    |                                                                                                                                                                  |\n| `lower`              | Converts all uppercase characters in a string into lowercase characters                                                             | Input: `{\"fname\": \"John\"}` <br /> Expression: `lower(fname)` <br /> Output: `john`                                                                                                                       |                                                                                                                                                                  |\n| `mid`                | Returns a specified number of characters from the middle of a given text string                                                     | Input: `{\"greeting\": \"hello world!\"}` <br /> Expression: `mid(greeting, `4`, `3`)` <br /> Output: `o w`                                                                                                  |                                                                                                                                                                  |\n| `json_parse`         | Returns parsed object from the given json string                                                                                    | Input: `{\"data\": '{\"greeting\": \"hello world!\"}'}` <br /> Expression: `parse_json(data)` <br /> Output: `{\"greeting\": \"hello world!\"}`                                                                    |                                                                                                                                                                  |\n| `regex_replace`      | Replaces a string that matches a regular expression                                                                                 | Input: `{\"text\": \"Banana Bannnana\"}` <br /> Expression: `regex_replace(text, 'Ban\\w+', 'Apple Apple')` <br /> Output: `Apple Apple`                                                                      |                                                                                                                                                                  |\n| `replace`            | Replaces all the occurrences of a substring with a new one                                                                          | Input: `{\"sentence\": \"one four three four!\"}` <br /> Expression: `replace(sentence, 'four', 'two')` <br /> Output: `one two three two!`                                                                  |                                                                                                                                                                  |\n| `right`              | Returns a specified number of characters from the end of a given text string                                                        | Input: `{\"greeting\": \"hello world!\"}` <br /> Expression: `right(greeting, `6`)` <br /> Output: `world!`                                                                                                  |                                                                                                                                                                  |\n| `split`              | Splits a string into a list of strings after breaking the given string by the specified delimiter (comma by default)                | Input: `{\"departments\": \"finance,hr,r&d\"}` <br /> Expression: `split(departments)` <br /> Output: `['finance', 'hr', 'r&d']`                                                                             | Default delimiter is comma - a different delimiter can be passed to the function as the second argument, for example: `split(departments, ';')`                  |\n| `time_delta_days`    | Returns the number of days between a given `dt` and now (positive) or the number of days that have passed from now (negative)       | Input: `{\"dt\": '2021-10-06T18:56:16.701670+00:00'}` <br /> Expression: `time_delta_days(dt)` <br /> Output: `365`                                                                                        | If `dt` is a string, ISO datetime (2011-11-04T00:05:23+04:00, for example) is assumed. If `dt` is a number, Unix timestamp (1320365123, for example) is assumed. |\n| `time_delta_seconds` | Returns the number of seconds between a given `dt` and now (positive) or the number of seconds that have passed from now (negative) | Input: `{\"dt\": '2021-10-06T18:56:16.701670+00:00'}` <br /> Expression: `time_delta_days(dt)` <br /> Output: `31557600`                                                                                   | If `dt` is a string, ISO datetime (2011-11-04T00:05:23+04:00, for example) is assumed. If `dt` is a number, Unix timestamp (1320365123, for example) is assumed. |\n| `to_entries`         | Converts a given object into an array of objects with `key` and `value` properties                                                  | Input: `{\"name\": \"John\", \"age\": 30, \"city\": null}` <br /> Expression: `to_entries(@)` <br /> Output: `[{\"key\": \"name\", \"value\": \"John\"}, {\"key\": \"age\", \"value\": 30}, {\"key\": \"city\", \"value\": null}]`   |                                                                                                                                                                  |\n| `upper`              | Converts all lowercase characters in a string into uppercase characters                                                             | Input: `{\"fname\": \"john\"}` <br /> Expression: `upper(fname)` <br /> Output: `JOHN`                                                                                                                       |                                                                                                                                                                  |\n| `uuid`               | Generates a random UUID4 and returns it as a string in standard format                                                              | Input: None <br /> Expression: `uuid()` <br /> Output: `3264b35c-ff5d-44a8-8bc7-9be409dac2b7`                                                                                                            |                                                                                                                                                                  |"
    }
  ],
  "examples": []
}
