title: Reading json data into java objects
body: <p>I am reading data from Excel using java into a json array like this:</p>
  
  <pre><code> FileInputStream inp = new FileInputStream("C://temp/testdata.xls");
              HSSFWorkbook workbook = new HSSFWorkbook(inp);
  
              // Get the first Sheet.
              Sheet sheet = workbook.getSheetAt(0);
  
              //Start constructing JSON.
              JSONObject json = new JSONObject();
  
              // Iterate through the rows.
              JSONArray rows = new JSONArray();
  
              for ( Iterator&lt;Row&gt; rowsIT = sheet.rowIterator(); rowsIT.hasNext(); )
              {
                  Row row = rowsIT.next();
                  JSONObject jRow = new JSONObject();
  
                  // Iterate through the cells.
                  JSONArray cells = new JSONArray();
                  for ( Iterator&lt;Cell&gt; cellsIT = row.cellIterator(); cellsIT.hasNext(); )
                  {
                      Cell cell = cellsIT.next();
                      cells.put( cell.getStringCellValue() );
                  }
                  jRow.put( "cell", cells );
                  rows.put( jRow );
              }
  
              // Create the JSON.
              json.put("rows", rows);
  
              myvalue = json.toString();
              System.out.println(myvalue);
  </code></pre>
  
  <p>My excel file looks like this:</p>
  
  <pre><code>TestCase    SearchString    PageTitle
  TC1.01          Ferrari         Ferrari - Google Searching
  TC1.02          Toyota          Toyota - Google Searching
  TC1.03          Mazda           Google
  TC1.04          Volvo           Google
  </code></pre>
  
  <p>First row is my column names.</p>
  
  <p>When I print my values out I get this:</p>
  
  <pre><code>{"rows":[{"cell":["TestCase","SearchString","PageTitle"]},{"cell":["TC1.01","Ferrari","Ferrari - Google Searching"]},{"cell":["TC1.02","Toyota","Toyota - Google Searching"]},{"cell":["TC1.03","Mazda","Google"]},{"cell":["TC1.04","Volvo","Google"]}]}
  </code></pre>
  
  <p>How do I map the column names with the data in java?  For example:  How can I map the SearchString column with Ferarri?  (and so on)</p>
  
  <p>Would appreciate any help  :-)</p>