# Issues parsing JSON with deep nesting

**URL:** <https://discuss.elastic.co/t/issues-parsing-json-with-deep-nesting/176133>\
**Category:** Logstash\
**Created:** [April 10, 2019, 5:05am UTC](https://discuss.elastic.co/t/issues-parsing-json-with-deep-nesting/176133 "2019-04-10T05:05:43Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![Dallas\_Toth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dallas_toth/32/22630_2.png) [@Dallas\_Toth](https://discuss.elastic.co/u/Dallas_Toth)\
**Post date:** [April 11, 2019, 9:07pm UTC](https://discuss.elastic.co/t/issues-parsing-json-with-deep-nesting/176133/21 "2019-04-11T21:07:58Z")

</div>

One step closer to the edge. So I got the split { field =\> "[data][children]" } working and the data is coming in from that. But getting an error for the replies split to get the data in from those.

> [2019-04-11T15:04:00,651][WARN][logstash.filters.split] Only String and Array types are splittable. field:[replies] is of type = NilClass

```
split { field => "[data][children]" }

if [data][children][data][body]
  {
  mutate
    {
      add_field => {
        "id" => "%{[data][children][data][id]}"
        "replyid" => "%{[data][children][data][id]}"
        "reference" => "%{[data][children][data][subreddit]}"
        "text" => "%{[data][children][data][body]}"
        "postid" => "%{[data][children][data][link_id]}"
        "author" => "%{[data][children][data][author]}"
        "score" => "%{[data][children][data][score]}"
        "link" => "http://reddit.com%{[data][children][data][permalink]}"
      }
    }
  }
mutate
  {
    remove_field => ["[data]"]
  }

split { field => "[replies]" }

if [replies][body]
  {
  mutate
    {
      add_field => {
        "id" => "%{[replies][id]}"
        "replyid" => "%{[replies][id]}"
        "reference" => "%{[replies][subreddit]}"
        "text" => "%{[replies][body]}"
        "postid" => "%{[replies][link_id]}"
        "author" => "%{[replies][author]}"
        "score" => "%{[replies][score]}"
        "link" => "http://reddit.com%{[replies][permalink]}"
      }
    }
  }
  mutate
  {
    remove_field => ["[replies]"]
  }

```

---

<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:** [April 11, 2019, 9:29pm UTC](https://discuss.elastic.co/t/issues-parsing-json-with-deep-nesting/176133/22 "2019-04-11T21:29:32Z")

</div>

That's on the first event, which doesn't have any replies. I thought you were going to drop that... Otherwise

```
if [replies] { split { field => "[replies]" } }
```

---

<div class="post-metadata">

**Author:** ![Dallas\_Toth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dallas_toth/32/22630_2.png) [@Dallas\_Toth](https://discuss.elastic.co/u/Dallas_Toth)\
**Post date:** [April 11, 2019, 9:38pm UTC](https://discuss.elastic.co/t/issues-parsing-json-with-deep-nesting/176133/23 "2019-04-11T21:38:31Z")

</div>

[data][children][data] has the initial comment which is needed and the code you created has all the replies to those comments.  
Basically I need to have the [id],[subreddit],[body],[link\_id],[author],[score], and [permalink] of each.

So currently I am trying to bring the [replies] and the [data][children][data] into the root.

---

<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:** [May 9, 2019, 9:38pm UTC](https://discuss.elastic.co/t/issues-parsing-json-with-deep-nesting/176133/24 "2019-05-09T21:38:37Z")

</div>

Closed on May 9, 2019, 9:38pm UTC

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

[Previous page](https://discuss.elastic.co/t/issues-parsing-json-with-deep-nesting/176133.md?page=1)
