# After Split again merge the json object

**URL:** <https://discuss.elastic.co/t/after-split-again-merge-the-json-object/285333>\
**Category:** Logstash\
**Created:** [September 28, 2021, 9:25am UTC](https://discuss.elastic.co/t/after-split-again-merge-the-json-object/285333 "2021-09-28T09:25:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ansgoya](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@ansgoya](https://discuss.elastic.co/u/ansgoya)\
**Post date:** [September 28, 2021, 9:25am UTC](https://discuss.elastic.co/t/after-split-again-merge-the-json-object/285333/1 "2021-09-28T09:25:33Z")

</div>

Hi Team,

I am splitting the data and mutate the fields but i want to again merge the objects so filter {  
if [data] {

```
    split {
      field => "data"
      target => "indexData"
    }
    if !("" in [indexData][bcd]) {
      mutate { add_field => {"[indexData][type]" => "CD"} }
    }
     if !("" in [indexData][env]) {
      mutate { add_field => {"[@metadata][target_index]" => "wtf-index"} }
    } else {
      mutate {
        add_field => { "[@metadata][target_index]" => "%{[indexData][env]}wtf-index" }
      }
    }

```

after this i want to again merge all indexData in json so is there any 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:** [October 26, 2021, 9:26am UTC](https://discuss.elastic.co/t/after-split-again-merge-the-json-object/285333/2 "2021-10-26T09:26:32Z")

</div>

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