title: Processing JSON using java Mapreduce
body: <p>I am new to hadoop mapreduce</p>
  
  <p>I have input text file where data has been stored as follow. Here are only a few tuples (data.txt)</p>
  
  <pre><code>{"author":"Sharīf Qāsim","book":"al- Rabīʻ al-manshūd"}
  {"author":"Nāṣir Nimrī","book":"Adīb ʻAbbāsī"}
  {"author":"Muẓaffar ʻAbd al-Majīd Kammūnah","book":"Asmāʼ Allāh al-ḥusná al-wāridah fī muḥkam kitābih"}
  {"author":"Ḥasan Muṣṭafá Aḥmad","book":"al- Jabhah al-sharqīyah wa-maʻārikuhā fī ḥarb Ramaḍān"}
  {"author":"Rafīqah Salīm Ḥammūd","book":"Taʻlīm fī al-Baḥrayn"}
  </code></pre>
  
  <p>This is my java file that I am supposed to write my code in (CombineBooks.java)</p>
  
  <pre><code>package org.hwone;
  
  import org.apache.hadoop.conf.Configuration;
  import org.apache.hadoop.mapreduce.Job;
  import org.apache.hadoop.util.GenericOptionsParser;
  
  //TODO import necessary components
  
  /*
  *  Modify this file to combine books from the same other into
  *  single JSON object. 
  *  i.e. {"author": "Tobias Wells", "books": [{"book":"A die in the country"},{"book": "Dinky died"}]}
  *  Beaware that, this may work on anynumber of nodes! 
  *
  */
  
  public class CombineBooks {
  
    //TODO define variables and implement necessary components
  
    public static void main(String[] args) throws Exception {
      Configuration conf = new Configuration();
      String[] otherArgs = new GenericOptionsParser(conf, args)
                  .getRemainingArgs();
      if (otherArgs.length != 2) {
        System.err.println("Usage: CombineBooks &lt;in&gt; &lt;out&gt;");
        System.exit(2);
      }
  
      //TODO implement CombineBooks
  
      Job job = new Job(conf, "CombineBooks");
  
      //TODO implement CombineBooks
  
      System.exit(job.waitForCompletion(true) ? 0 : 1);
    }
  }
  </code></pre>
  
  <p>My task is to create a Hadoop program in “CombineBooks.java”
  returned in the “question-2” directory. The program should do
  the following: Given the input author-book tuples, map-reduce
  program should procude a JSON object which contains all the
  books from same author in a JSON array, i.e.</p>
  
  <pre><code>{"author": "Tobias Wells", "books":[{"book":"A die in the country"},{"book": "Dinky died"}]} 
  </code></pre>
  
  <p><strong>Any idea how it can be done ?</strong></p>