title: Extracting one specific data from a JSon file then sum all of them up
body: <p>So I'm kind of stuck. I'm experiencing with JSon and I'm trying to get all the total_price of different orders from a JSON file. I can read the file, but I'm having issue getting that specific information then sum it all up. </p>
  
  <p>Here's the code I have so far.  </p>
  
  <pre><code>public static void main(String[] args) {
  
  
  
  
          JSONParser parser = new JSONParser();
  
          try {
  
              Object obj = parser.parse(new FileReader(
                      "/orders.json"));
  
              JSONObject jsonObject = (JSONObject) obj;
  
  
              JSONArray orderList = (JSONArray) jsonObject.get("orders");
  
              System.out.println("\norders");
              Iterator&lt;String&gt; iterator = orderList.iterator();
              while (iterator.hasNext()) {
  
                  System.out.println(iterator.next());
              }
              obj = parser.parse(sCurrentLine);
      JSONArray jsonArray = (JSONArray) obj;
      for(obj : jsonArray){
          JSONObject jsonObject = (JSONObject)obj;
          JSONObject realTitle = (JSONObject)jsonObject.get("0");
          String name = (String) realTitle.get("title");
      }
  
          } catch (Exception e) {
              e.printStackTrace();
          }
  
      }
  </code></pre>
  
  <p>For the JSON file: </p>
  
  <pre><code>{
  "orders":[
  {
  "id":4251070723,
  "email":"heathcote_amya@gmail.com",
  "closed_at":null,
  "created_at":"2016-12-05T23:16:40-05:00",
  "updated_at":"2016-12-05T23:16:40-05:00",
  "number":137,
  "note":null,
  "token":"c460f260f4f38b8a2b1f78e6efd0140e",
  "gateway":"",
  "test":false,
  "total_price":"179.04",
  "default":true
  },
  {
  "id":4251070787,
  "email":"napoleon.batz@gmail.com",
  "closed_at":null,
  "created_at":"2016-12-05T23:16:40-05:00",
  "updated_at":"2016-12-05T23:16:41-05:00",
  "number":138,
  "note":null,
  "token":"54c4f1735cfec8f98ad16ae5e9a161cd",
  "gateway":"",
  "test":false,
  "total_price":"14.62"
  }
  ]
  }
  </code></pre>
  
  <p>The error I get is for(obj : jsonArray) is causing me issue, but honestly, I don't think I'm even on the right path. </p>
  
  <p>Thanks a lot for your help in advance! </p>