title: Parse large json data in Java with arrays and strings in json values
body: <p>The json string generated from the media server looks like this </p>
  
  <pre><code>{
      "id": 1,
      "jsonrpc": "2.0",
      "result": {
          "albums": [
              {
                  "albumid": 1,
                  "albumlabel": "",
                  "artist": [
                      "www.SongsLover.pk"
                  ],
                  "artistid": [
                      2
                  ],
                  "description": "",
                  "genre": [
                      "Pop"
                  ],
                  "label": "Single 2012",
                  "rating": 0,
                  "style": [
                      ""
                  ],
                  "thumbnail": "image://music@smb%3a%2f%2fCECOTS-NAS%2fMedia%2fMusic%2fbackup%20Music%2fSissle2%2fGangnam%20Style%20.mp3/",
                  "title": "Single 2012",
                  "type": "",
                  "year": 0
              },
              {
                  "albumid": 164,
                  "albumlabel": "",
                  "artist": [
                      "ARrahman","MJ"
                  ],
                  "artistid": [
                      146,163
                  ],
                  "description": "",
                  "genre": [
                      "Soundtrack"
                  ],
                  "label": "Lord of the rings",
                  "rating": 0,
                  "style": [
                      ""
                  ],
                  "thumbnail": "image://music@smb%3a%2f%2fCECOTS-NAS%2fMedia%2fMusic%2fExtras_Test%2fEnakkena%20Yenave.mp3/",
                  "title": "Lord of the rings",
                  "type": "",
                  "year": 2000
              },{..........},{........},{........}
          ],
          "limits": {
              "end": 155,
              "start": 0,
              "total": 155
          }
      }
  }
  </code></pre>
  
  <p>The following is the code i tried using Java. Iam getting the json response as <strong>Input stream</strong> and using jsonreader to parse the json response. But here in the above json, the <strong>artist</strong> dictionary has array values without names. </p>
  
  <pre><code>JsonReader reader = new JsonReader(new InputStreamReader(inputStream,
                          "UTF-8"));
  ArrayList&lt;Integer&gt; albumId = new ArrayList&lt;Integer&gt;();
  ArrayList&lt;String&gt; artistId = new ArrayList&lt;String&gt;();
      while (reader.hasNext()) {
                  String name = reader.nextName();
                  if (name.equalsIgnoreCase("result")) {
                      reader.beginObject();
                      while (reader.hasNext()) {
                          String check = reader.nextName();
  
                          if (check.equalsIgnoreCase(type)) {
                              reader.beginArray();
                              int i = 0;
                              while (reader.hasNext()) {
                                  i++;
  
                                      reader.beginObject();
                                      int albumid;
                                      String artistid = null;
  
                                      while (reader.hasNext()) {
  
                                          name = reader.nextName();
                                          if (name.equalsIgnoreCase("albumid")) {
                                              albumid = reader.nextInt();
                                              albumId.add(albumid);
                                          } else if (name
                                                  .equalsIgnoreCase("artist")) {
                                              reader.beginArray();
                                              while(reader.hasNext()){
                                                  artistid = reader.nextString();
                                                  artistId.add(artistid);
                                              }
                                              reader.endArray();
                                          }  else {
                                              reader.skipValue();
                                          }
                                      }
  
                                      reader.endObject();
                                  //}
                              }
                              Log.i(LOGCAT, Integer.toString(i));
                              reader.endArray();
                          } else {
                              reader.skipValue();
                          }
                      }
  
                      reader.endObject();
                  } else {
                      reader.skipValue();
                  }
              }
              reader.endObject();
  </code></pre>
  
  <p>So, the problem for me is how to get the array values from the <strong>artist</strong> dictionary with the above code. Please help me in this. Thanks in advance.</p>