# Nested json inside a json also getting parsed into different fields using JSON Filter Plugin

**URL:** https://discuss.elastic.co/t/nested-json-inside-a-json-also-getting-parsed-into-different-fields-using-json-filter-plugin/250939
**Category:** Logstash
**Created:** [October 5, 2020, 7:29am UTC](https://discuss.elastic.co/t/nested-json-inside-a-json-also-getting-parsed-into-different-fields-using-json-filter-plugin/250939 "2020-10-05T07:29:17Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ParashB](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@ParashB](https://discuss.elastic.co/u/ParashB)
#### Post date: [October 5, 2020, 7:29am UTC](https://discuss.elastic.co/t/nested-json-inside-a-json-also-getting-parsed-into-different-fields-using-json-filter-plugin/250939/1 "2020-10-05T07:29:17Z")

</div>

Hi,

I have a nested JSON inside a JSON field which is also getting parsed. I do not want to parse the nested JSON. example json:

`log : {"name":"abc","location":{"city":"New York","country":"US"}}`

Logstash filter:  
json {  
source =\> "log"  
}

Parsed as  
{  
"name":"abc",  
"location.city":"New York",  
"location.country":"US"  
}

But the requirement is to have it in this format  
{  
"name":"abc",  
"location":"{"city":"New York","country":"US"}"  
}

---

<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: [October 5, 2020, 2:10pm UTC](https://discuss.elastic.co/t/nested-json-inside-a-json-also-getting-parsed-into-different-fields-using-json-filter-plugin/250939/2 "2020-10-05T14:10:34Z")

</div>

You cannot stop it parsing it, you could re-encode it using the json\_encode filter.

---

<div class="post-metadata">

### Author: ![ParashB](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@ParashB](https://discuss.elastic.co/u/ParashB)
#### Post date: [October 6, 2020, 8:58am UTC](https://discuss.elastic.co/t/nested-json-inside-a-json-also-getting-parsed-into-different-fields-using-json-filter-plugin/250939/3 "2020-10-06T08:58:03Z")

</div>

The problem is its not just 2-3 fields but 1000s of fields in the nested json which is causing a mapping explode in the index. I need to stop the nested json to be parsed into different fields.

---

<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: [October 6, 2020, 1:36pm UTC](https://discuss.elastic.co/t/nested-json-inside-a-json-also-getting-parsed-into-different-fields-using-json-filter-plugin/250939/4 "2020-10-06T13:36:49Z")

</div>

Maybe you should turn off [dynamic mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-mapping.html).

---

<div class="post-metadata">

### Author: ![ParashB](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@ParashB](https://discuss.elastic.co/u/ParashB)
#### Post date: [October 7, 2020, 10:27am UTC](https://discuss.elastic.co/t/nested-json-inside-a-json-also-getting-parsed-into-different-fields-using-json-filter-plugin/250939/5 "2020-10-07T10:27:33Z")

</div>

Thanks @Badger, disabling dynamic mapping helped. Mapping as below

"location" : {  
"type" : "object",  
"enabled" : false  
}

---

<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 4, 2020, 10:27am UTC](https://discuss.elastic.co/t/nested-json-inside-a-json-also-getting-parsed-into-different-fields-using-json-filter-plugin/250939/6 "2020-11-04T10:27:35Z")

</div>

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