List of Built-in Functions

While there are some extensions made to the JMESPath query language in DocuMotor, a lot of functionality is documented at jmespath.org.

You can find information on each specific function by following the links below.

JMESPathReferenceOutput
absnumber abs(number $value)Returns the absolute value of the provided argument.
avgnumber avg(array[number] $elements)Returns the average of the elements in the provided array.
containsboolean contains(array|string $subject, any $search)Returns true if the given $subject contains the provided $search string.
If $subject is an array, this function returns true if one of the elements in the array is equal to the provided $search value.
If the provided $subject is a string, this function returns true if the string contains the provided $search argument.
ceilnumber ceil(number $value)Returns the next highest integer value by rounding up if necessary.
ends_withboolean ends_with(string $subject, string $prefix)Returns true if the $subject ends with the $prefix, otherwise this function returns false.
floornumber floor(number $value)Returns the next lowest integer value by rounding down if necessary.
joinstring join(string $glue, array[string] $stringsarray)Returns all of the elements from the provided $stringsarray array joined together using the $glue argument as a separator between each.
keysarray keys(object $obj)Returns an array containing the keys of the provided object. Note that because JSON hashes are inheritently unordered, the keys associated with the provided object obj are inheritently unordered. Implementations are not required to return keys in any specific order.
lengthnumber length(string|array|object $subject)Returns the length of the given argument using the following types rules:
string: returns the number of code points in the string
array: returns the number of elements in the array
object: returns the number of key-value pairs in the object
maparray[any] map(expression->any->any expr, array[any] elements)Apply the expr to every element in the elements array and return the array of results. An elements of length N will produce a return array of length N.
Unlike a projection, ([*].bar), map() will include the result of applying the expr for every element in the elements array, even if the result if null.
maxnumber max(array[number]|array[string] $collection)Returns the highest found number in the provided array argument.
An empty array will produce a return value of null.
max_bymax_by(array elements, expression->number|expression->string expr)Return the maximum element in an array using the expression expr as the comparison key. The entire maximum element is returned.
mergeobject merge([object *argument, [, object $...]])Accepts 0 or more objects as arguments, and returns a single object with subsequent objects merged. Each subsequent object’s key/value pairs are added to the preceding object. This function is used to combine multiple objects into one. You can think of this as the first object being the base object, and each subsequent argument being overrides that are applied to the base object.
minnumber min(array[number]|array[string] $collection)Returns the lowest found number in the provided $collection argument.
min_bymin_by(array elements, expression->number|expression->string expr)Return the minimum element in an array using the expression expr as the comparison key. The entire maximum element is returned.
not_nullany not_null([any $argument [, any $...]])Returns the first argument that does not resolve to null. This function accepts one or more arguments, and will evaluate them in order until a non null argument is encounted. If all arguments values resolve to null, then a value of null is returned.
reversearray reverse(string|array $argument)Reverses the order of the $argument.
sortarray sort(array[number]|array[string] $list)This function accepts an array $list argument and returns the sorted elements of the $list as an array.
The array must be a list of strings or numbers. Sorting strings is based on code points. Locale is not taken into account.
sort_bysort_by(array elements, expression->number|expression->string expr)Sort an array using an expression expr as the sort key. For each element in the array of elements, the expr expression is applied and the resulting value is used as the key used when sorting the elements.
If the result of evaluating the expr against the current array element results in type other than a number or a string, an invalid-type error will occur.
starts_withboolean starts_with(string $subject, string $prefix)Returns true if the $subject starts with the $prefix, otherwise this function returns false.
sumnumber sum(array[number] $collection)Returns the sum of the provided array argument.
An empty array will produce a return value of 0.
to_arrayarray to_array(any $arg)array – Returns the passed in value.
number/string/object/boolean – Returns a one element array containing the passed in argument.
to_stringstring to_string(any $arg)string – Returns the passed in value.
number/array/object/boolean – The JSON encoded value of the object. The JSON encoder should emit the encoded JSON value without adding any additional new lines.
to_numbernumber to_number(any $arg)string – Returns the parsed number. Any string that conforms to the json-number production is supported.
number – Returns the passed in value.
array – null
object – null
boolean – null
null – null
typestring type(array|object|string|number|boolean|null $subject)Returns the JavaScript type of the given $subject argument as a string value.
The return value MUST be one of the following:
number
string
boolean
array
object
null
valuesarray values(object $obj)Returns the values of the provided object. Note that because JSON hashes are inheritently unordered, the values associated with the provided object obj are inheritently unordered. Implementations are not required to return values in any specific order.