# Import JSON with nested fields

**URL:** <https://discuss.elastic.co/t/import-json-with-nested-fields/275010>\
**Category:** Logstash\
**Created:** [June 5, 2021, 1:42am UTC](https://discuss.elastic.co/t/import-json-with-nested-fields/275010 "2021-06-05T01:42:56Z")\
**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:** [June 5, 2021, 2:07am UTC](https://discuss.elastic.co/t/import-json-with-nested-fields/275010/2 "2021-06-05T02:07:08Z")

</div>

If your json file is pretty-printed like that then you will need to use a multiline codec to consume the file as a single event. [This](https://discuss.elastic.co/t/parsing-array-of-json-objects-with-logstash-and-injesting-to-elastic/203197/2) is an example of how to do that.

You do not need two json filters. The first one will parse all the nested fields.

The split should be

```
split { field => "[message][items]" }

```

You may then want to move some of the fields to the root, which can be done using ruby, like [this](https://discuss.elastic.co/t/parsing-array-of-json-objects-with-logstash-and-injesting-to-elastic/203197/2).

---

_[View the full topic](https://discuss.elastic.co/t/import-json-with-nested-fields/275010)._
