# Ruby filter for parsing deeply nested JSON in pipeline

**URL:** https://discuss.elastic.co/t/ruby-filter-for-parsing-deeply-nested-json-in-pipeline/161050
**Category:** Logstash
**Created:** [December 16, 2018, 7:19pm UTC](https://discuss.elastic.co/t/ruby-filter-for-parsing-deeply-nested-json-in-pipeline/161050 "2018-12-16T19:19:59Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Chris\_Lyons](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_lyons/32/48107_2.png) [@Chris\_Lyons](https://discuss.elastic.co/u/Chris_Lyons)
#### Post date: [January 13, 2019, 6:42pm UTC](https://discuss.elastic.co/t/ruby-filter-for-parsing-deeply-nested-json-in-pipeline/161050/4 "2019-01-13T18:42:53Z")

</div>

As promised:

Latest ruby filter code: [gist link](https://gist.github.com/cjlyons81/8f47a281934c8e7c040d7bf8985db331)  
Example pipeline usage:

> ruby {  
> path =\> "/path-to-file/json-to-event.rb"  
> script\_params =\> {  
> "json\_field" =\> "notes" \<--Specify the field you want to extract json from (default: message)  
> "array" =\> true \<--Do you want to flatten arrays within the json (default: false)  
> "target" =\> "parent" \<--Specify root level name if wanted (default: root of document)  
> "tag\_match\_failure" =\> true \<--Do you want to tag event when json regex match fails (defaults: false)  
> }  
> }

---

_[View the full topic](https://discuss.elastic.co/t/ruby-filter-for-parsing-deeply-nested-json-in-pipeline/161050)._
