# How can I parse nested JSON object with arrays and dict into Elasticsearch using Logstash

**URL:** <https://discuss.elastic.co/t/how-can-i-parse-nested-json-object-with-arrays-and-dict-into-elasticsearch-using-logstash/284971>\
**Category:** Logstash\
**Created:** [September 23, 2021, 8:15am UTC](https://discuss.elastic.co/t/how-can-i-parse-nested-json-object-with-arrays-and-dict-into-elasticsearch-using-logstash/284971 "2021-09-23T08:15:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaikadil95](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaikadil95/32/94977_2.png) [@shaikadil95](https://discuss.elastic.co/u/shaikadil95)\
**Post date:** [September 23, 2021, 8:15am UTC](https://discuss.elastic.co/t/how-can-i-parse-nested-json-object-with-arrays-and-dict-into-elasticsearch-using-logstash/284971/1 "2021-09-23T08:15:41Z")

</div>

I have a nested JSON object below.

```auto
{
  "data": {
    "testChannels": [
      {
        "name": "TC1",
        "Time": "2021-08-31 12:02:51.103188",
        "info": {
          "user": "johan",
          "epic": "Epic"
        },
        "template": {
          "name": "E"
        },
        "nodes": [
          {
            "instance": {
              "name": "u00871"
            }
          },
          {
            "instance": {
              "name": "u00388"
            }
          },
          {
            "instance": {
              "name": "qc-5946"
            }
          },
          {
            "instance": {
              "name": "us00009"
            }
          }
        ]
      },
      {
        "name": "TC4",
        "Time": "2021-09-21 13:23:02.985500",
        "info": {
          "user": "eak",
          "epic": "Ex"
        },
        "template": {
          "name": "AVI"
        },
        "nodes": [
          {
            "instance": {
              "name": "e0294"
            }
          },
          {
            "instance": {
              "name": "us00646"
            }
          },
          {
            "instance": {
              "name": "sim00183"
            }
          }
        ]
      }
    ]
  }
}

```

I want to store the data as two documents Tc1, TC4 with all the data in key value fashion.  
Please help Thanks

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [September 23, 2021, 2:43pm UTC](https://discuss.elastic.co/t/how-can-i-parse-nested-json-object-with-arrays-and-dict-into-elasticsearch-using-logstash/284971/2 "2021-09-23T14:43:14Z")

</div>

You can use a split filter to extract two events from the [data][testChannels] array, then use mutate to move fields around if you do not like the data layout.

---

<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:** [October 21, 2021, 2:43pm UTC](https://discuss.elastic.co/t/how-can-i-parse-nested-json-object-with-arrays-and-dict-into-elasticsearch-using-logstash/284971/3 "2021-10-21T14:43:44Z")

</div>

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