# How to load json data into another json data structure

**URL:** <https://discuss.elastic.co/t/how-to-load-json-data-into-another-json-data-structure/279512>\
**Category:** Logstash\
**Created:** [July 23, 2021, 6:20pm UTC](https://discuss.elastic.co/t/how-to-load-json-data-into-another-json-data-structure/279512 "2021-07-23T18:20:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![venkataraman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/venkataraman/32/85046_2.png) [@venkataraman](https://discuss.elastic.co/u/venkataraman)\
**Post date:** [July 23, 2021, 6:20pm UTC](https://discuss.elastic.co/t/how-to-load-json-data-into-another-json-data-structure/279512/1 "2021-07-23T18:20:26Z")

</div>

Hello Everyone,

I just need a help in loading data in a nested json format.

I have a output something like this in the below format  
{  
"product" : "IPS"  
"Product\_Country" : "EMEA"  
"Tracking\_ID": "2335454523"  
"StartTime" : "2014-03-05T12:01:04.357Z"  
"EndTime" : "2014-03-05T12:02:07.357Z"  
}

But I want the output something like below.

{  
"duration": {  
"process\_start\_time": "2014-03-05T12:01:04.357Z",  
"process\_end\_time": "2014-03-05T12:02:07.357Z"  
},  
"status": {  
"transaction\_number": "2335454523"  
},  
"Location": {  
"countryName": "EMEA"  
},  
"product\_details": {  
"product\_name": "IPS"  
}  
}

For example, value of StartTime and EndTime values should get renamed as "process\_start\_time" and "process\_end\_time". Also, these two fields should be nested inside "duration" field. Like this, I want to do for other fields also to follow above nested json structure.

Someone please help me out how can I achieve it as I am new to logstash. kindly post some suggestions or solutions to be followed to achieve the result.

Thank you so much everyone in advance.

---

<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:** [July 23, 2021, 6:33pm UTC](https://discuss.elastic.co/t/how-to-load-json-data-into-another-json-data-structure/279512/2 "2021-07-23T18:33:00Z")

</div>

You can use mutate+rename to move fields

```
mutate {
    rename => {
        "StartTime" => "[duration][process_start_time]"
        "EndTime" => "[duration][process_end_time]"
        "Product_Country" => "[location][countryName]"
        ... etc etc
    }
}
```

---

<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 20, 2021, 6:33pm UTC](https://discuss.elastic.co/t/how-to-load-json-data-into-another-json-data-structure/279512/3 "2021-08-20T18:33:19Z")

</div>

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