# Logstash json restructuring

**URL:** <https://discuss.elastic.co/t/logstash-json-restructuring/114200>\
**Category:** Logstash\
**Created:** [January 5, 2018, 4:41am UTC](https://discuss.elastic.co/t/logstash-json-restructuring/114200 "2018-01-05T04:41:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raj2](https://avatars.discourse-cdn.com/v4/letter/r/74df32/32.png) [@Raj2](https://discuss.elastic.co/u/Raj2)\
**Post date:** [January 5, 2018, 4:41am UTC](https://discuss.elastic.co/t/logstash-json-restructuring/114200/1 "2018-01-05T04:41:40Z")

</div>

I have a structure like  
{  
f1: 12,  
f2 : {  
nf1: {........}  
}  
}

I want to convert it to { f1:12, nf1: {......} }

When I try add\_field { "nf1"=\> "[f2][nf1]" }, the RHS is not evaluated. If I use %{}, the value is stringified JSON. I also tried adding field nf1 and then copying value-

add\_field =\> { "nf1" =\> {}}  
copy =\> { "[f2][nf1]" =\> "nf1" }

But this also does not work. How to do it ?

---

<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:** [January 5, 2018, 9:37am UTC](https://discuss.elastic.co/t/logstash-json-restructuring/114200/2 "2018-01-05T09:37:59Z")

</div>

Have you tried using a mutate filter to rename `[f2][nf1]` to `nf1`?

---

<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:** [February 2, 2018, 9:38am UTC](https://discuss.elastic.co/t/logstash-json-restructuring/114200/3 "2018-02-02T09:38:03Z")

</div>

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