title: Convert a .json file to a JSONArray
body: <p>I used cURL to get some twitter feeds in the form of a json file ("twitter-feed.json"). I want to convert this json file to a JSONArray object. How do I do it?</p>
  
  <p>I am new to Java and json. Your suggestions are most welcome.</p>
  
  <pre><code>FileInputStream infile = new FileInputStream("input/twitter-feed.json");
  </code></pre>
  
  <p>// parse JSON
          JSONArray jsonArray = new JSONArray(string); </p>
  
  <pre><code>    // use
      for (int i = 0; i &lt; jsonArray.length(); i++) {
          JSONObject jsonObject = jsonArray.getJSONObject(i);
  
          System.out.println(jsonObject.getString("id"));
          System.out.println(jsonObject.getString("text"));               
          System.out.println(jsonObject.getString("created_at"));     
      }
  </code></pre>
  
  <p>Thanks,
  PD.</p>