# Flatten JSON array (Simple, but I don't know ruby) Please help!

**URL:** <https://discuss.elastic.co/t/flatten-json-array-simple-but-i-dont-know-ruby-please-help/139212>\
**Category:** Logstash\
**Created:** [July 9, 2018, 4:16pm UTC](https://discuss.elastic.co/t/flatten-json-array-simple-but-i-dont-know-ruby-please-help/139212 "2018-07-09T16:16:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan.Ivis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan.ivis/32/32553_2.png) [@Ryan.Ivis](https://discuss.elastic.co/u/Ryan.Ivis)\
**Post date:** [July 9, 2018, 4:16pm UTC](https://discuss.elastic.co/t/flatten-json-array-simple-but-i-dont-know-ruby-please-help/139212/1 "2018-07-09T16:16:15Z")

</div>

Here is what my Objects look like.  
{  
"severity": "",  
"organization\_name": "",  
"source": "",  
"organization\_id": "",  
"server\_or\_region": "",  
"created\_at": "",  
"title": "",  
"id": ""  
},  
{  
"severity": "",  
"organization\_name": "",  
"source": "",  
"organization\_id": "",  
"server\_or\_region": "",  
"created\_at": "",  
"title": "",  
"id": ""  
}

It's a nested json array, there could be anywhere from 1 to 100 of these in a single message.

Any tips for a ruby filter to flatten this?

---

<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:** [July 9, 2018, 6:15pm UTC](https://discuss.elastic.co/t/flatten-json-array-simple-but-i-dont-know-ruby-please-help/139212/2 "2018-07-09T18:15:40Z")

</div>

So you have a field with an array of objects in it and you want to split that array so that each object gets its own event, or what's the desired outcome?

---

<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:** [August 6, 2018, 6:19pm UTC](https://discuss.elastic.co/t/flatten-json-array-simple-but-i-dont-know-ruby-please-help/139212/3 "2018-08-06T18:19:16Z")

</div>

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