# How to query json url with http module

**URL:** <https://discuss.elastic.co/t/how-to-query-json-url-with-http-module/155572>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [November 6, 2018, 3:42pm UTC](https://discuss.elastic.co/t/how-to-query-json-url-with-http-module/155572 "2018-11-06T15:42:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aert](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@Aert](https://discuss.elastic.co/u/Aert)\
**Post date:** [November 6, 2018, 3:42pm UTC](https://discuss.elastic.co/t/how-to-query-json-url-with-http-module/155572/1 "2018-11-06T15:42:01Z")

</div>

Hello Team,

I have enabled http module in _metricbeat_ and am currently trying to get the HTTP body of a JSON endpoint.  
For now it doesn't work, the error.message i get is:

```
json: cannot unmarshal array into Go value of type map[string]interface {}

```

Any ideas where I am going wrong?

content of the **http.yml** module:

```
- module: http
  metricsets: ["json"]
  period: 10s
  hosts: ["localhost:8182"]
  namespace: "json_namespace"
  path: "/TDV/isAlive"
  body: ""
  method: "GET"
  request.enabled: true
  response.enabled: true

```

Content of the url at **[http://localhost:8182/TDV/isAlive](http://localhost:8182/TDV/isAlive)**

`[{"name":"smx.services","status":true},{"name":"smx.amont","status":true},{"name":"smx.core","status":true},{"name":"smx.aval","status":true},{"name":"smx.wsn.partner","status":true},{"name":"smx.mq","status":true},{"name":"GEO","status":true},{"name":"MOT1","status":true},{"name":"MOT2","status":true}]`

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [November 6, 2018, 4:22pm UTC](https://discuss.elastic.co/t/how-to-query-json-url-with-http-module/155572/2 "2018-11-06T16:22:10Z")

</div>

Hi, what version of metricbeat are you running? It looks like the root element of your JSON body is an array. Metricbeat wasn't able to handle this until 6.3.0: [https://github.com/elastic/beats/pull/6480](https://github.com/elastic/beats/pull/6480).

---

<div class="post-metadata">

**Author:** ![Aert](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@Aert](https://discuss.elastic.co/u/Aert)\
**Post date:** [November 15, 2018, 10:06am UTC](https://discuss.elastic.co/t/how-to-query-json-url-with-http-module/155572/3 "2018-11-15T10:06:19Z")

</div>

I tried with the 6.4 version and it works perfectly !  
Thanks a lot

---

<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:** [December 13, 2018, 10:08am UTC](https://discuss.elastic.co/t/how-to-query-json-url-with-http-module/155572/4 "2018-12-13T10:08:01Z")

</div>

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