# How to prevent json parsing of a field in Logstash?

**URL:** <https://discuss.elastic.co/t/how-to-prevent-json-parsing-of-a-field-in-logstash/178270>\
**Category:** Logstash\
**Created:** [April 24, 2019, 2:18pm UTC](https://discuss.elastic.co/t/how-to-prevent-json-parsing-of-a-field-in-logstash/178270 "2019-04-24T14:18:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)\
**Post date:** [April 24, 2019, 2:18pm UTC](https://discuss.elastic.co/t/how-to-prevent-json-parsing-of-a-field-in-logstash/178270/1 "2019-04-24T14:18:49Z")

</div>

Hi,

I am using Logstasg GA 6.3.0. I am taking data from a kafka topic like below;

```
input {
	kafka{
		group_id => "mygroup"
		topics => ["mytopic"]
		bootstrap_servers => "192.168.0.1:9092"
		codec => "json"
	}
}

```

everything is working fine. My data has many fields like field\_a, field\_b etc, which gets automatically parsed with the help of JSON codec. one of my fields `field_c` has another JSON data in it. Logstash also parses that and I can see the child elements as attributes in Kibana. I don't want that. I want that JSON as plain text, which means Logshash should not tokenize `field_c`. Is this possible?

Thanks.

---

<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:** [April 24, 2019, 2:42pm UTC](https://discuss.elastic.co/t/how-to-prevent-json-parsing-of-a-field-in-logstash/178270/2 "2019-04-24T14:42:23Z")

</div>

I don't think you can prevent it parsing it, but you could use the [json\_encode](https://www.elastic.co/guide/en/logstash/current/plugins-filters-json_encode.html) plugin to overwrite it with serialized JSON.

---

<div class="post-metadata">

**Author:** ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)\
**Post date:** [April 25, 2019, 8:29am UTC](https://discuss.elastic.co/t/how-to-prevent-json-parsing-of-a-field-in-logstash/178270/3 "2019-04-25T08:29:13Z")

</div>

Hi @Badger , when I looked into the documentations, I was able to see `add_field`, `add_tag`, `enable_metric`, `id`, `periodic_flush`, `remove_field`, and `remove_tag` options. Could you kindly tell me what should I use here, and how to use?

---

<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:** [April 25, 2019, 1:52pm UTC](https://discuss.elastic.co/t/how-to-prevent-json-parsing-of-a-field-in-logstash/178270/4 "2019-04-25T13:52:50Z")

</div>

You do not need to use the "Common Options". Just try

```
json_encode { source => "field_c" }

```

and it will overwrite field\_c with its serialized version.

---

<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:** [May 23, 2019, 1:52pm UTC](https://discuss.elastic.co/t/how-to-prevent-json-parsing-of-a-field-in-logstash/178270/5 "2019-05-23T13:52:55Z")

</div>

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