title: How to send streamed json data as a key value pair into kafka consumer
body: <p>i write a jave code read a json data from local file system, and i want send that data as a key value pair's</p>
  
  <pre><code>public static void main(String[] args) throws IOException 
  {
          Stream&lt;String&gt; objec = Files.lines(Paths.get("path\\data.json"));
  
  
                  String topicName="test";
  
                  Properties props=new Properties();
                  props.put("kafka.bootstrap.servers", "localhost:9092,localhost:9093");
                  props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
                  props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
  
  
                  KafkaProducer&lt;String,String&gt; sampleProducer= new KafkaProducer&lt;String,String&gt;(props);
                  objec.forEach(f-&gt;{
                  ProducerRecord&lt;String, String&gt; record = new ProducerRecord&lt;String, String&gt;(topicName,f);        
                  sampleProducer.send(record);
                  });
                  sampleProducer.close();
  </code></pre>
  
  <p>But when i run this program that will send a data to kafkaconsumer as a String, how could i send a json data as a key value pair to kafka consumer...</p>
  
  <p>here the sample json file</p>
  
  <pre><code>{  
     "wifi_result":"1",
     "mic_result":"1",
     "video_result":"1",
     "touch_result":"1",
     "proximity_result":"1",
     "vibrator_result":"1",
     "power_key":"2",
     "accelerometer":"0",
     "earphone":"1",
     "memory_result":"1",
     "memory_internalSD":"1",
     "memory_internalSDSize":"25.0GB",
     "memory_externalSD":"0",
     "memory_externalSDSize":"",
     "memory_internalflash":"1",
     "memory_internalflashSize":"2.0GB",
     "vol_key_down":"0",
     "menu_key":"1",
     "headset_result":"1",
  
  }
  </code></pre>
  
  <p>Help will be appreciate... Thanks in advance...</p>