You need to implement both encode and decoder
public class JsonEncoder implements Encoder
The decoder code
public class JsonDecoder implements Decoder
The pom entry
com.fasterxml.jackson.core
jackson-databind
2.4.1.3
Set the default encoder in the Kafka property
properties.put("serializer.class","kafka.serializer.DefaultEncoder");
The writer and reader code is as follows
byte[] bytes = encoder.toBytes(map);
KeyedMessage message =new KeyedMessage(this.topic, bytes);
JsonDecoder decoder = new JsonDecoder(null);
Map map = (Map) decoder.fromBytes(it.next().message());