title: Json file data into kafka topic
body: <p>How to insert json file data into kafka topic using kafka-console-producer?
  Can each json data set be stored as a message?</p>
  <p>example-</p>
  <pre><code>{
    &quot;id&quot;: 1,
    &quot;first_name&quot;: &quot;John&quot;,
    &quot;last_name&quot;: &quot;Lindt&quot;,
    &quot;email&quot;: &quot;jlindt@gmail.com&quot;,
    &quot;gender&quot;: &quot;Male&quot;,
    &quot;ip_address&quot;: &quot;1.2.3.4&quot;
  }
  </code></pre>
  <p>If you use this command -</p>
  <pre><code>cat sampledata.json|kafka-console-producer --broker-list localhost:9092 --topic  stream-test-topic
  </code></pre>
  <p>Each line is taken as a separate message.</p>
  <p>What is the right way to do this?</p>
  <p>Thanks!</p>
  <p>ps-</p>
  <p>The topic is being read by Elastic search. Sample json message file -</p>
  <pre><code>[{
    &quot;id&quot;: 1,
    &quot;first_name&quot;: &quot;John&quot;,
    &quot;last_name&quot;: &quot;Lindt&quot;,
    &quot;email&quot;: &quot;jlindt@gmail.com&quot;,
    &quot;gender&quot;: &quot;Male&quot;,
    &quot;ip_address&quot;: &quot;1.2.3.4&quot;
  }, {
    &quot;id&quot;: 2,
    &quot;first_name&quot;: &quot;Peter&quot;,
    &quot;last_name&quot;: &quot;Friz&quot;,
    &quot;email&quot;: &quot;Friz3@gmail.com&quot;,
    &quot;gender&quot;: &quot;Male&quot;,
    &quot;ip_address&quot;: &quot;4.5.6.7&quot;
  }, {
    &quot;id&quot;: 3,
    &quot;first_name&quot;: &quot;Dell&quot;,
    &quot;last_name&quot;: &quot;Chang&quot;,
    &quot;email&quot;: &quot;Dellc@gmail.com&quot;,
    &quot;gender&quot;: &quot;Female&quot;,
    &quot;ip_address&quot;: &quot;8.9.10.11&quot;
  }, {
    &quot;id&quot;: 4,
    &quot;first_name&quot;: &quot;Lolita&quot;,
    &quot;last_name&quot;: &quot;John&quot;,
    &quot;email&quot;: &quot;LolitaJ@gmail.com&quot;,
    &quot;gender&quot;: &quot;Female&quot;,
    &quot;ip_address&quot;: &quot;12.13.14.15&quot;
  }, {
    &quot;id&quot;: 5,
    &quot;first_name&quot;: &quot;Pele&quot;,
    &quot;last_name&quot;: &quot;Wang&quot;,
    &quot;email&quot;: &quot;Pele@gmail.com&quot;,
    &quot;gender&quot;: &quot;Male&quot;,
    &quot;ip_address&quot;: &quot;16.17.18.19&quot;
  }, {
    &quot;id&quot;: 6,
    &quot;first_name&quot;: &quot;Rene&quot;,
    &quot;last_name&quot;: &quot;Charm&quot;,
    &quot;email&quot;: &quot;Rene3@gmail.com&quot;,
    &quot;gender&quot;: &quot;Male&quot;,
    &quot;ip_address&quot;: &quot;20.21.22.23&quot;
  }]
  </code></pre>