# Monitor array of objects in JSON response

**URL:** <https://discuss.elastic.co/t/monitor-array-of-objects-in-json-response/190145>\
**Category:** Beats\
**Tags:** heartbeat\
**Created:** [July 12, 2019, 5:50am UTC](https://discuss.elastic.co/t/monitor-array-of-objects-in-json-response/190145 "2019-07-12T05:50:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wu3rstle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wu3rstle/32/49963_2.png) [@wu3rstle](https://discuss.elastic.co/u/wu3rstle)\
**Post date:** [July 12, 2019, 5:50am UTC](https://discuss.elastic.co/t/monitor-array-of-objects-in-json-response/190145/1 "2019-07-12T05:50:52Z")

</div>

I've tried monitoring a service with nested JSON using Heartbeat 7.2.0.  
Several variants for the check.response.json are not working.

I've tried the following keys for the array check:

```
data[0].state:
data[0][state]:
data.0.state:
data.[0].state:
"[data][0][state]":

```

Do you have an idea how to configure the checks for nested json structures?

The json i have is something like that:

```
{
    "links": {
        "self": "https://example.com/some/url"
    },
    "data": [
        {
            "id": "0",
            "state": "active",
            "hostname": "host1"
        },
        {
            "id": "1",
            "state": "active",
            "hostname": "host2"
        },
        {
            "id": "2",
            "state": "active",
            "hostname": "host3"
        },
        {
            "id": "3",
            "state": "active",
            "hostname": "host4"
        },
        {
            "id": "4",
            "state": "active",
            "hostname": "host5"
        }
    ],
}

```

My heartbeat config looks like that:

```
heartbeat.monitors:
- type: http
  name: "Example-check"
  schedule: '@every 10s'
  urls:
    - "https://example.com/some/url"
  tags: ["rancher_env", "qa"]
  check.response:
    status: 200
    json:
    - description: "self link"
      condition:
        equals:
          link.self: "https://example.com/some/url"
    - description: "host 0"
      condition:
        equals:
          data[0].state: "active"

output.console:
  pretty: true
```

---

<div class="post-metadata">

**Author:** ![wu3rstle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wu3rstle/32/49963_2.png) [@wu3rstle](https://discuss.elastic.co/u/wu3rstle)\
**Post date:** [July 15, 2019, 9:14am UTC](https://discuss.elastic.co/t/monitor-array-of-objects-in-json-response/190145/2 "2019-07-15T09:14:02Z")

</div>

No suggestion????

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [July 16, 2019, 3:37pm UTC](https://discuss.elastic.co/t/monitor-array-of-objects-in-json-response/190145/3 "2019-07-16T15:37:13Z")

</div>

Unfortunately we don't currently support that, we do have an open issue in beats however here: [https://github.com/elastic/beats/issues/12490](https://github.com/elastic/beats/issues/12490) . It's something we hope to get to in the medium term.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 13, 2019, 3:37pm UTC](https://discuss.elastic.co/t/monitor-array-of-objects-in-json-response/190145/4 "2019-08-13T15:37:22Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
