title: How to get distinct JSON keys from a file full of JSON and redirect entries to specific directory structures?
body: <p>My requirement is that I get a JSON file from a Kafka topic in Kafka Stream, from which I need to group the JSON entries based on the keys and then dump those entries into different directories which are named after the keys.</p>
  
  <p>For example:
  I have a file with different JSON entries with Keys "A", "B", "A" &amp; "C".</p>
  
  <p>I need the above entries to be dumped into different directories. ie. Directory A will be created and the entry with JSON key "A" will go into a file in that directory. 
  Directory B will be created and the two entries for the key "B" will go into a file in that directory and so on.</p>