# Kafka input json

**URL:** <https://discuss.elastic.co/t/kafka-input-json/32567>\
**Category:** Logstash\
**Created:** [October 20, 2015, 11:47am UTC](https://discuss.elastic.co/t/kafka-input-json/32567 "2015-10-20T11:47:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![afreen](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@afreen](https://discuss.elastic.co/u/afreen)\
**Post date:** [October 20, 2015, 11:47am UTC](https://discuss.elastic.co/t/kafka-input-json/32567/1 "2015-10-20T11:47:21Z")

</div>

Hi,

I have input coming from kafka topic to logstash. Which is json data.

JSON structure of my data

"field1" : "val1",  
"field2" : "val2",  
"field3" : {  
"field4" : {  
"field5" : "val5",  
"field6" : "val6"  
}  
}

input {  
kafka {  
topic\_id =\> 'topic\_name'  
zk\_connect =\> 'zk\_host:2181'  
codec =\> "json"  
add\_field =\> { "test1" =\> "%{field3}"  
"test2" =\> "%{field1}"  
"test3" =\> "%{field5}"  
"test4" =\> "%{field3.field4}"  
"test5" =\> "%{field3.field4.field5}"  
}  
}  
}

in the above input from conf file, I am getting new fields "test1" and "test2" values from input data.

Where as I am not getting the value for "test5". which is nested element in the json data.

Please let me know what is missing here.

I have tried with JSON filter and getting json parse failure. I tried to install json\_encode plugin, which is showing incorrect URL to get the plugin as mentioned below

$ plugin install logstash-filter-json\_encode --verbose

-\> Installing logstash-filter-json\_encode...  
Trying [https://github.com/null/logstash-filter-json\_encode/archive/master.zip](https://github.com/null/logstash-filter-json_encode/archive/master.zip)...  
Failed: IOException[Can't get [https://github.com/null/logstash-filter-json\_encode/a](https://github.com/null/logstash-filter-json_encode/a)

Thanks

---

<div class="post-metadata">

**Author:** ![afreen](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@afreen](https://discuss.elastic.co/u/afreen)\
**Post date:** [October 20, 2015, 11:58am UTC](https://discuss.elastic.co/t/kafka-input-json/32567/2 "2015-10-20T11:58:15Z")

</div>

I got "test5", If I modify the field as below

"test5" =\> "%{[field3][field4][field5]}"

But what about json\_encode plugin install issue

versions that are using here are  
elasticsearch-1.7.3  
logstash-1.5.4

---

<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:** [July 6, 2017, 5:26am UTC](https://discuss.elastic.co/t/kafka-input-json/32567/3 "2017-07-06T05:26:03Z")

</div>


