# Json filter to parse nested json

**URL:** <https://discuss.elastic.co/t/json-filter-to-parse-nested-json/83755>\
**Category:** Logstash\
**Created:** [April 26, 2017, 7:14pm UTC](https://discuss.elastic.co/t/json-filter-to-parse-nested-json/83755 "2017-04-26T19:14:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![harshinim](https://avatars.discourse-cdn.com/v4/letter/h/e5b9ba/32.png) [@harshinim](https://discuss.elastic.co/u/harshinim)\
**Post date:** [April 26, 2017, 7:14pm UTC](https://discuss.elastic.co/t/json-filter-to-parse-nested-json/83755/1 "2017-04-26T19:14:24Z")

</div>

I have the below json

{"test1":1,"test2":2,"usage":{"test3":3,"test4":4}}

and I want the output to be  
test1:1, test2:2, usage.test3:3, usage.test4:4

Also the filter needs to be dynamic, I don't know the name of the nested fields nor would I know the number of levels.

---

<div class="post-metadata">

**Author:** ![LmYjQ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lmyjq/32/97480_2.png) [@LmYjQ](https://discuss.elastic.co/u/LmYjQ)\
**Post date:** [April 27, 2017, 3:22am UTC](https://discuss.elastic.co/t/json-filter-to-parse-nested-json/83755/2 "2017-04-27T03:22:27Z")

</div>

I have the same problem, looking forward for some solutions.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [April 27, 2017, 5:26am UTC](https://discuss.elastic.co/t/json-filter-to-parse-nested-json/83755/3 "2017-04-27T05:26:44Z")

</div>

> and I want the output to be  
> test1:1, test2:2, usage.test3:3, usage.test4:4

That's what you literally want? There's no standard filter for doing that, but use a json filter or codec to parse the input JSON, then use a ruby filter to serialize the resulting fields into the desired format.

---

<div class="post-metadata">

**Author:** ![harshinim](https://avatars.discourse-cdn.com/v4/letter/h/e5b9ba/32.png) [@harshinim](https://discuss.elastic.co/u/harshinim)\
**Post date:** [April 30, 2017, 10:02pm UTC](https://discuss.elastic.co/t/json-filter-to-parse-nested-json/83755/4 "2017-04-30T22:02:37Z")

</div>

Thanks Magnus, will try that.

---

<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 28, 2017, 10:03pm UTC](https://discuss.elastic.co/t/json-filter-to-parse-nested-json/83755/5 "2017-05-28T22:03:29Z")

</div>

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