JSONPath Online logojsonpath.online

JMESPath Functions Reference

All official JMESPath functions with signatures, examples, and common pitfalls. Copy any expression into the playground and test instantly.

Array functions

length

length(array|string|object)

Returns the length of an array, string, or object keys.

length([1,2,3])

3

length(keys({a:1,b:2}))

2

sort_by

sort_by(array, &expr)

Sorts an array of objects by the given expression.

sort_by(people, &age)[].name

["Bob","Alice","Cara"]

Pitfall: Only works on arrays; ensure numbers are comparable.

reverse

reverse(array)

Reverses an array.

reverse([1,2,3])

[3,2,1]

max_by / min_by

max_by(array, &expr) / min_by(array, &expr)

Returns the element with the max/min value for expr.

max_by(inventory, &price).name

"gizmo"

sum

sum(array)

Sums an array of numbers.

sum(orders[].total)

362.5

avg

avg(array)

Average of numeric array.

avg([1,2,3])

2

String functions

contains

contains(collection, value)

Checks if a string contains a substring or array contains value.

contains('hello', 'ell')

true

contains(['a','b'], 'b')

true

starts_with / ends_with

starts_with(string, prefix) / ends_with(string, suffix)

Case-sensitive prefix/suffix check.

starts_with('prod-app', 'prod')

true

join

join(delimiter, array)

Joins array of strings.

join(',', people[0].skills)

"aws,python"

split

split(delimiter, string)

Splits string by delimiter.

split('.', 'a.b.c')

["a","b","c"]

Object functions

keys / values

keys(object) / values(object)

Returns keys or values of an object.

keys({a:1,b:2})

["a","b"]

merge

merge(obj1, obj2, ...)

Merges objects from left to right.

merge({a:1}, {b:2})

{"a":1,"b":2}

to_array

to_array(value)

Wraps a value in an array if needed.

to_array('x')

["x"]

to_string / to_number

to_string(value) / to_number(value)

Coerces values to string or number where possible.

to_number('42')

42

to_string(true)

"true"

Type & boolean helpers

type

type(value)

Returns the type name (string, number, array, object, boolean, null).

type(people)

"array"

not_null

not_null(value1, value2, ...)

Returns the first non-null argument.

not_null(null, 'fallback')

"fallback"

map

map(&expr, array)

Applies expression to each element; shorthand for projections.

map(&name, people)

["Alice","Bob","Cara"]

Math & misc

abs, ceil, floor

abs(number) / ceil(number) / floor(number)

Common math helpers.

ceil(5.2)

6

floor(5.8)

5

max / min

max(array) / min(array)

Max/min of numbers.

max([1,5,2])

5