Skip to content

JSON

On this page
  1. Settings
  2. When is it healthy?
  3. The measured value
  4. Examples

The JSON sensor calls an API, reads one value from the JSON response with a JSONPath, and compares it to the value you expect. Use it to check what an API says, not only that it answers: a component status, a queue length, a latency reported by the service itself.

In the wizard: API → JSON response content.

Header of Public API — Response time, a JSON sensor: GET request with a 10 s timeout, the JSONPath $.p95_ms, the rule "Less than 800", case-insensitive comparison and SSL verification.
A JSON sensor reads one value with a JSONPath and checks it against a rule, here the API's own p95 latency.

Settings#

The request settings are those of the HTTP sensor (except HEAD), plus a Response validation section:

Setting Description
JSONPath Where to read the value, for example $.status or $.components[0].state.
Condition How to compare: Equal to, Not equal to, More than, Less than, Match regex, String contains, string length and array conditions (Array contains, Array length equal to…).
Value type String, integer, decimal or date, depending on the condition.
Value to check The expected value.
Case sensitive For text comparisons.

When is it healthy?#

When the request succeeds with an accepted code, the JSONPath finds a value, and the condition holds.

The measured value#

When the value is numeric, it is recorded with each check and drawn on the sensor's chart: you see its evolution, not only up or down. See Results and history.

Examples#

  • Public API — Response time: $.p95_ms Less than 800. The API reports its own p95 latency; the sensor fails when it goes over 800 ms.
  • Notifications — SMS gateway: $.component.status Equal to operational on the provider's status API.