# Make Array of objects as type nested

**URL:** <https://discuss.elastic.co/t/make-array-of-objects-as-type-nested/182635>\
**Category:** Logstash\
**Created:** [May 24, 2019, 11:37am UTC](https://discuss.elastic.co/t/make-array-of-objects-as-type-nested/182635 "2019-05-24T11:37:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sayed\_Atif](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sayed_atif/32/46687_2.png) [@Sayed\_Atif](https://discuss.elastic.co/u/Sayed_Atif)\
**Post date:** [May 24, 2019, 11:37am UTC](https://discuss.elastic.co/t/make-array-of-objects-as-type-nested/182635/1 "2019-05-24T11:37:18Z")

</div>

I am using JDBC-input and pulling data from Postgres. My input statement looks like

```
statement => "select a.id, a.deleted_at, a.updated_at, json_agg(b.*)::text as user_hubs, json_agg(c.*)::text as user_schools, json_agg(d.*)::text as user_clusters
      from users a
      left join user_hubs b on a.id = b.user_id
      left join user_schools c on a.id = c.user_id
      left join user_clusters d on a.id = d.user_id
      group by a.id
      limit 20"

```

I have a filter which helps me parse JSON

```
filter {
  json {
    source => "user_hubs"
    target => "user_hubs"
  }
  json {
    source => "user_clusters"
    target => "user_clusters"
  }
}

```

I get an output as

```
{
  "deleted_at": "2018-01-16T17:18:13.000Z",
  "user_hubs": [
      {
          "message": null,
          ...
      }
  ],
  "updated_at": "2018-01-16T17:18:13.000Z",
  "@timestamp": "2019-05-24T10:59:42.363Z",
  "id": 11014,
  "user_clusters": [
      {
          "deleted_at": "2018-01-16T22:48:13+05:30",
          "full_unsubscribed": false,
          ...
      }
  ],
  "user_schools": [
      null
  ],
  "@version": "1"
}

```

I want user\_clusters and user\_hubs to be nested object type. what I am missing ??

---

<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:** [June 21, 2019, 11:37am UTC](https://discuss.elastic.co/t/make-array-of-objects-as-type-nested/182635/2 "2019-06-21T11:37:19Z")

</div>

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