# How to write Customize grok with multiple json values?

**URL:** <https://discuss.elastic.co/t/how-to-write-customize-grok-with-multiple-json-values/135238>\
**Category:** Logstash\
**Created:** [June 9, 2018, 7:34pm UTC](https://discuss.elastic.co/t/how-to-write-customize-grok-with-multiple-json-values/135238 "2018-06-09T19:34:04Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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 10, 2018, 1:15pm UTC](https://discuss.elastic.co/t/how-to-write-customize-grok-with-multiple-json-values/135238/4 "2018-06-10T13:15:47Z")

</div>

> [@Badger](#):
>
> mutate { gsub =\> ["message", "[{", "", "message", "}]", "", "message", "}, {", "|" ] } mutate { split =\> { "message" =\> "|" } } kv { source =\> "[message][0]" target =\> "[foo][0]" field\_split =\> "," }

OK, well it turns out kv handles an array on input, so you can do

```
kv { source => "[message]" target => "[foo]" field_split => "," }

```

If you then want to have the arrays inverted, you could do that in ruby using something like [this](https://discuss.elastic.co/t/how-can-i-get-elasticsearch-filter-plugin-result-in-json-list-in-c/133788/3).

---

_[View the full topic](https://discuss.elastic.co/t/how-to-write-customize-grok-with-multiple-json-values/135238)._
