# Create new json from existing json

**URL:** <https://discuss.elastic.co/t/create-new-json-from-existing-json/153983>\
**Category:** Logstash\
**Created:** [October 25, 2018, 11:10am UTC](https://discuss.elastic.co/t/create-new-json-from-existing-json/153983 "2018-10-25T11:10:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zeeshan\_Alam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zeeshan_alam/32/94298_2.png) [@Zeeshan\_Alam](https://discuss.elastic.co/u/Zeeshan_Alam)\
**Post date:** [October 25, 2018, 11:10am UTC](https://discuss.elastic.co/t/create-new-json-from-existing-json/153983/1 "2018-10-25T11:10:50Z")

</div>

I am getting data in this format:

```
{
	"a": "1",
	"b": "2"
}

```

I want it to changes to:

```
{
	data: {
		"a": "1",
		"b": "2"
	}
}

```

I can change it using the mutate filter:

```
mutate {
	 rename => {
		"[a]" => "[data][a]"
		"[b]" => "[data][b]"
	}
}

```

But here I have to rename each field individually.

Is there a way I can move the entire incoming message inside data field, something like:

```
rename => {"[entite_message]" => "[data][entire_message]"}
```

---

<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:** [November 22, 2018, 11:10am UTC](https://discuss.elastic.co/t/create-new-json-from-existing-json/153983/2 "2018-11-22T11:10:51Z")

</div>

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