# Kafka input convert to json

**URL:** https://discuss.elastic.co/t/kafka-input-convert-to-json/215785
**Category:** Logstash
**Created:** [January 20, 2020, 6:22pm UTC](https://discuss.elastic.co/t/kafka-input-convert-to-json/215785 "2020-01-20T18:22:13Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [January 20, 2020, 9:22pm UTC](https://discuss.elastic.co/t/kafka-input-convert-to-json/215785/2 "2020-01-20T21:22:30Z")

</div>

That looks to me as though you have the wrong encoding. You can specify this using the [charset](https://www.elastic.co/guide/en/logstash/7.5/plugins-codecs-plain.html#plugins-codecs-plain-charset) option on the codec for the input. That is, add something like

```
codec => plain { charset => "UTF-8" }

```

I do not think that text is UTF-8, I am just giving you an example.

Once your messages look good I would use dissect to take the prefix off the line and then a kv filter, similar to [this](https://discuss.elastic.co/t/parsing-firewall-logs-in-logstash/212786/2).

---

_[View the full topic](https://discuss.elastic.co/t/kafka-input-convert-to-json/215785)._
