title: Android, JSON array into ArrayList<String>
body: <p><br>
  How to parse JSON string array into Java arraylist<br></p>
  
  <p>I have this json:</p>
  
  <pre><code>{
  "a": [
      "A-lore ipsum 1",
      "A-lore ipsum 2",
      "A-lore ipsum 3"
  ],
  "b": [
      "B-lore ipsum 1",       
      "B-lore ipsum 2",
      "B-lore ipsum 3"
  ]
  }
  </code></pre>
  
  <p><br>
  this is my original code : </p>
  
  <pre><code>//v refers to  **a or b**
  public ArrayList getJSON(String v){
      ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
      InputStream is = getResources().openRawResource(R.raw.myjson);
      Writer writer = new StringWriter();
      char[] buffer = new char[1024];
      Reader reader = null;
  
      try {
          reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
          int n;
          while ((n = reader.read(buffer)) != -1) {
              writer.write(buffer, 0, n);
          }
  
          String json = writer.toString();
          JSONObject jsonObject = new JSONObject(json);
          list = jsonObject.getString(v); //how to create list according to category
  
      } catch (Exception e) {  e.printStackTrace();}
  
      return list;
  }
  </code></pre>
  
  <p>So I would like my list to look like: <br>
  <strong>if v = 'a';</strong></p>
  
  <pre><code>list = {"A-lore ipsum 1","A-lore ipsum 2","A-lore ipsum 3"};
  </code></pre>
  
  <p><strong>if v = 'b';</strong></p>
  
  <pre><code>list = {"B-lore ipsum 1","B-lore ipsum 2","B-lore ipsum 3"};
  </code></pre>