Handlebar Helper Function: JSONPath

Use JSONPath expressions to query and filter JSON objects. Use this helper to extract specific values or arrays from complex JSON objects.

This helper is available in the Summer ’26 release of Marketing Cloud Next (API version 67.0).

ParameterTypeDescription
objectObject, Array, or StringRequired. The JSON object, array, or JSON string to query.
expressionStringRequired. The JSONPath expression to apply to the object. All JSONPath expressions begin with $.

The expression parameter can include these JSONPath patterns:

  • $.field — Access a property in the top level of the object.
  • $.a.b — Access a nested property by specifying its path.
  • $[x] — Access an array element by its index. Arrays are zero-indexed, so the first item in the array is item 0.
  • $[x:y] — Select a range of array elements. The starting element of the range is zero-indexed and inclusive, and the ending element is exclusive, so [0:3] returns the first three objects in the array.
  • $[-1] — Access the final element in an array.
  • $[*] — Select all elements in an array.
  • $..field — Find all values of the specified field, regardless of its level in the parent object. This pattern is known as recursive descent.
  • $[?(expr)] — Filter the expression by specifying a field, operator, and value.

When you use the $[?(expr)] syntax to filter an expression, the filter can contain these operators:

  • == — equality
  • != — inequality
  • < — less than
  • > — greater than
  • <= — less than or equal to
  • >= — greater than or equal to
  • && — logical AND
  • || — logical OR
  • =~ — regular expression (regex) match

The data type of the return value depends on the JSONPath expression.

Definite paths, which are expressions that refer to a single value, return the value itself. The data type of the value can be a string, number, boolean, object, or array. If the specified value isn’t found, the function throws an exception.

Indefinite paths, which are expressions that include wildcards and filters, return an array of matching values. If no matches are found, the function returns an empty array [].

To access a nested property from an object, use dot notation, as shown in these examples.

The functions return the properties from the specified object. If the specified properties don’t exist, the function throws an exception.

You can use this function to access data in arrays, as shown in this example:

The function returns an array that contains the first three objects from the items array.

This example selects all elements in the items array.

This example finds all occurrences of the price field, regardless of their level in the parent object.

This example filters the parent object to include only elements from the items array where the value of the price field is greater than 100.