Skip to content

4.5JSON path (API only)

Type: json.<path>, such as json.data.status. Checks: one value inside a JSON response. JSON is a common text format for data, such as {"status": "ok"}. It works on URL, API and multi-step API monitors. You add it through the API. The dashboard does not offer it, but keeps it when you edit the monitor.

Write the path as names joined by dots. To pick an item from a list, use its position, counting from 0. For example, json.items.0.sku is the sku of the first item. A path must not be empty: json. alone is refused.

How obsrvly reads the value at the path:

  • Text is read as it is.
  • Numbers are read as numbers. 1.0 compares as 1, and 1e3 as 1000.
  • Yes/no values read as true or false.
  • null (no value) reads as empty text.
  • An object or a list reads as compact JSON text. Use contains with it.

Operators: eq, neq, contains, matches. Use gt and lt for numbers.

TypeOperatorValueWhat it means
json.statuseqokThe top-level status is ok.
json.data.countgt0The result is not empty.
json.items.0.stockgt0The first item is in stock.
JSON path in an API request
json
{"type": "json.status", "op": "ASSERTION_OP_EQ",
 "value": "ok"}

When it fails: assertion json.status == "ok": got "degraded". If the path does not exist, or the response is not JSON, you see assertion json.status: path not found. obsrvly reads the first 1 MiB of the body.

Last updated