# Need help flatten json object in logstash filter

**URL:** https://discuss.elastic.co/t/need-help-flatten-json-object-in-logstash-filter/71720
**Category:** Logstash
**Created:** [January 16, 2017, 11:20am UTC](https://discuss.elastic.co/t/need-help-flatten-json-object-in-logstash-filter/71720 "2017-01-16T11:20:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![MarcelHallmann](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@MarcelHallmann](https://discuss.elastic.co/u/MarcelHallmann)
#### Post date: [January 16, 2017, 11:20am UTC](https://discuss.elastic.co/t/need-help-flatten-json-object-in-logstash-filter/71720/1 "2017-01-16T11:20:13Z")

</div>

Hi,

my data structure is as follows:  
`{ "name": "my-validation", "timestamp": "<sometimestamp>", "details": { "2017-01-21": "My Validation result 1: OK", "2017-02-01": "My Validation result 2: OK", "2017-01-22": "My Validation result 3: OK", "2017-01-30": "My Validation result 4: OK" } }`

Every day the validation details key changes as it is a date.  
I need to visualize the details in a data table, but I can't bind the every-day changing keys to a field within the data table.

Now my idea was to split/mutate the events when reading it by logstash, so that the data structure would be:  
`{ "name": "my-validation", "timestamp": "<sometimestamp>", "details0": { "2017-01-21": "My Validation result 1: OK" }, "details1": { "2017-02-01": "My Validation result 2: OK" }, "details2": { "2017-01-22": "My Validation result 3: OK" }, "details3": { "2017-01-30": "My Validation result 4: OK" } }`  
so I could use the static fields details0, details1, etc. to create the data table.

Could anybody plz help to create the logstash-filter?  
Or is there any other possible solution?

---

<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: [February 13, 2017, 11:20am UTC](https://discuss.elastic.co/t/need-help-flatten-json-object-in-logstash-filter/71720/2 "2017-02-13T11:20:40Z")

</div>

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