# Parsing Nested JSON inside JSON getting NilClass

**URL:** <https://discuss.elastic.co/t/parsing-nested-json-inside-json-getting-nilclass/247593>\
**Category:** Logstash\
**Created:** [September 4, 2020, 8:08pm UTC](https://discuss.elastic.co/t/parsing-nested-json-inside-json-getting-nilclass/247593 "2020-09-04T20:08:48Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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 4, 2020, 9:10pm UTC](https://discuss.elastic.co/t/parsing-nested-json-inside-json-getting-nilclass/247593/2 "2020-09-04T21:10:13Z")

</div>

That looks like you have pretty-printed JSON in a file, which a file filter consumes one line at a time. None of those lines are going to be valid JSON, so the json codec will get a parse failure. Then the ruby filter will get an exception because there is no [results], then the split filter will get an exception for the same reason (the ruby filter does not get as far as adding the empty array if it gets an exception).

See [here](https://discuss.elastic.co/t/exception-logstash-unexpected-character-code-58-expected-a-valid-value-number-string-array-object-true-false-or-null/241198/2) for the solution.

The multiline code will replace the json code so you will have to add a json filter.

---

_[View the full topic](https://discuss.elastic.co/t/parsing-nested-json-inside-json-getting-nilclass/247593)._
