Skip to main content

JSONPath Routing

Route and reshape webhooks with safe JSONPath rules — no code execution required.

What It Is

JSONPath routing allows operators to define how incoming webhook events are delivered by evaluating rules against the event body. Instead of forwarding every event to every destination, JSONPath expressions match or transform event content for targeted routing.

Filter Conditions

Filters control whether an event matches a routing rule. Each condition evaluates a JSONPath expression against the event body:

ConditionBehavior
exactMatches events where the extracted value equals the specified string
regexpMatches events where the extracted value matches a regular expression
allAll sub-conditions must match (logical AND)
anyAt least one sub-condition must match (logical OR)
notInverts the match result of a sub-condition

Filter Examples

{
"match": {
"jsonpath": "$.event_type",
"exact": "charge.completed"
}
}

Route only charge.completed events to the payment processing destination:

{
"match": {
"jsonpath": "$.account.country",
"regexp": "^(US|CA|MX)$"
}
}

Match events from North American accounts using regex:

{
"match": {
"any": [
{ "jsonpath": "$.type", "exact": "push" },
{ "jsonpath": "$.type", "exact": "pull_request" }
]
}
}

Forward both push and pull_request events to a CI/CD destination:

{
"match": {
"not": {
"jsonpath": "$.source",
"exact": "sandbox"
}
}
}

Deliver all events except those from a sandbox source.

Route Selection

Routes are evaluated in priority order. The first matching route determines the delivery destination. If no route matches, the event is handled according to the default routing policy.

{
"routes": [
{
"name": "payment-events",
"match": { "jsonpath": "$.type", "exact": "charge.completed" },
"destination": "payment-processor"
},
{
"name": "analytics-events",
"match": { "jsonpath": "$.source", "regexp": "^analytics_" },
"destination": "analytics-pipeline"
}
]
}

Error Behavior

PolicyBehavior
fail_closedIf JSONPath evaluation encounters an error (missing field, invalid path), the event is not delivered to this destination
fail_openIf JSONPath evaluation encounters an error, the event is delivered anyway

Safety

  • JSONPath expressions operate on event body content only
  • No JavaScript, Lua, WASM, or user-supplied code execution
  • Evaluation is bounded — timeouts and resource limits prevent runaway expressions
  • The safe engine enforces a 50ms timeout and 10MB memory limit per expression

What V1 Supports

FeatureStatus
$ root selectorSupported
. child navigationSupported
['key'] bracket notationSupported
[*] wildcard array accessSupported
[N] numeric array indexSupported
.. deep scan (limited)Supported
@.field current contextSupported
String equality matchingSupported
exact / regexp / all / any / not conditionsSupported
fail_closed / fail_open error policiesSupported
Event type indexing (exact, prefix, regex)Supported

What V1 Does Not Support

FeatureStatus
[start:end:step] slice notationV1.1+
[-N] negative indexV1.1+
[?(expression)] filter expressionsV1.1+
length(), min(), max(), avg() aggregate functionsV1.1+
User-defined or custom functionsV1.1+
JavaScript, Lua, WASM, Python, CEL, Rego, or any plugin executionNot supported
Prompt-based local LLM routingNot available in V1