1

ドリルダウン ナビゲーション アプリを実行しようとしています。アルバム名のリストがあります。アルバムをクリックすると、その特定のアルバムの曲のリストが開きます。問題は、アルバムをクリックすると、他のすべてのアルバムのすべての曲も開くことです。

助けてください。以下は私のコーディングです。

アルバム JSON:

[
    {   "albumid": "1",
        "name":"127 Hours",
        "songs_count":"14"
    },
    {   "albumid": "2",
        "name":"Adele 21",
        "songs_count":"11"
    },
    {   "albumid": "3",
        "name":"Lana Del Rey - Born to Die",
        "songs_count":"12"
    },
    {   "albumid": "4",
        "name":"Once",
        "songs_count":"13"
    },
    {   "albumid": "5",
        "name":"Away We Go",
        "songs_count":"13"
    },
    {   "albumid": "6",
        "name":"Eminem Curtain Call",
        "songs_count":"14"
    },
    {   "albumid": "7",
        "name":"Bad Meets Evil Eminem",
        "songs_count":"11"
    },
    {   "albumid": "8",
        "name":"Safe Trip Home",
        "songs_count":"11"
    },
    {   "albumid": "9",
        "name":"No Angel",
        "songs_count":"12"
    }
]

曲リスト JSON:

 [
  {
    "albumid": "1",
    "album": "127 Hours",
    "songs": [
      {
        "id": "1",
        "name": "Never Hear Surf Music Again",
        "duration": "5:52"
      },
      {
        "id": "2",
        "name": "The Canyon",
        "duration": "3:01"
      },
      {
        "id": "3",
        "name": "Liberation Begins",
        "duration": "2:14"
      },
      {
        "id": "4",
        "name": "Touch of the Sun",
        "duration": "4:39"
      },
      {
        "id": "5",
        "name": "Lovely Day",
        "duration": "4:16"
      },
      {
        "id": "6",
        "name": "Ca Plane Pour Moi",
        "duration": "3:00"
      },
      {
        "id": "7",
        "name": "Liberation In A Dream",
        "duration": "4:06"
      },
      {
        "id": "8",
        "name": "If You Love Me (Really Love Me)",
        "duration": "3:27"
      },
      {
        "id": "9",
        "name": "Acid Darbari",
        "duration": "4:21"
      },
      {
        "id": "10",
        "name": "R.I.P.",
        "duration": "5:11"
      },
      {
        "id": "11",
        "name": "Festival",
        "duration": "9:26"
      },
      {
        "id": "12",
        "name": "If I Rise",
        "duration": "4:38"
      },
      {
        "id": "13",
        "name": "Liberation",
        "duration": "3:11"
      },
      {
        "id": "14",
        "name": "Nocturne No. 2 in E flat",
        "duration": "4:01"
      }
    ]
  },
  {
    "albumid": "2",
    "album": "Adele 21",
    "songs": [
      {
        "id": "1",
        "name": "Rolling In The Deep",
        "duration": "03:48"
      },
      {
        "id": "2",
        "name": "Rumour Has It",
        "duration": "03:43"
      },
      {
        "id": "3",
        "name": "Turning Tables",
        "duration": "04:10"
      },
      {
        "id": "4",
        "name": "Don\u2019t You Remember",
        "duration": "04:03"
      },
      {
        "id": "5",
        "name": "Set Fire To The Rain",
        "duration": "04:02"
      },
      {
        "id": "6",
        "name": "He Won\u2019t Go",
        "duration": "04:38"
      },
      {
        "id": "7",
        "name": "Take It All",
        "duration": "03:48"
      },
      {
        "id": "8",
        "name": "I\u2019ll Be Waiting",
        "duration": "04:01"
      },
      {
        "id": "9",
        "name": "One And Only",
        "duration": "05:48"
      },
      {
        "id": "10",
        "name": "Lovesong",
        "duration": "05:16"
      },
      {
        "id": "11",
        "name": "Someone Like You",
        "duration": "04:45"
      }
    ]
  },
  {
    "albumid": "3",
    "album": "Lana Del Rey - Born to Die",
    "songs": [
      {
        "id": "1",
        "name": "Born to Die",
        "duration": "4:46"
      },
      {
        "id": "2",
        "name": "Off to the Races",
        "duration": "5:00"
      },
      {
        "id": "3",
        "name": "Blue Jeans",
        "duration": "3:29"
      },
      {
        "id": "4",
        "name": "Video Games",
        "duration": "4:42"
      },
      {
        "id": "5",
        "name": "Diet Mountain Dew",
        "duration": "3:43"
      },
      {
        "id": "6",
        "name": "National Anthem",
        "duration": "3:51"
      },
      {
        "id": "7",
        "name": "Dark Paradise",
        "duration": "4:03"
      },
      {
        "id": "8",
        "name": "Radio",
        "duration": "3:35"
      },
      {
        "id": 9,
        "name": "Carmen",
        "duration": "4:09"
      },
      {
        "id": "10",
        "name": "Million Dollar Man",
        "duration": "3:50"
      },
      {
        "id": "11",
        "name": "Summertime Sadness",
        "duration": "4:25"
      },
      {
        "id": "12",
        "name": "This Is What Makes Us Girls",
        "duration": "4:00"
      }
    ]
  },
  {
    "albumid": "4",
    "album": "Once",
    "songs": [
      {
        "id": "1",
        "name": "Falling Slowly",
        "duration": "4:05"
      },
      {
        "id": "2",
        "name": "If You Want Me",
        "duration": "3:47"
      },
      {
        "id": "3",
        "name": "Broken Hearted Hoover Fixer Sucker Guy",
        "duration": "0:52"
      },
      {
        "id": "4",
        "name": "When Your Mind's Made Up",
        "duration": "3:42"
      },
      {
        "id": "5",
        "name": "Lies",
        "duration": "3:58"
      },
      {
        "id": "6",
        "name": "Gold",
        "duration": "3:59"
      },
      {
        "id": "7",
        "name": "The Hill",
        "duration": "4:34"
      },
      {
        "id": "8",
        "name": "Fallen From The Sky",
        "duration": "3:24"
      },
      {
        "id": "9",
        "name": "Leave",
        "duration": "2:46"
      },
      {
        "id": "10",
        "name": "Trying To Pull Myself Away",
        "duration": "3:35"
      },
      {
        "id": "11",
        "name": "All The Way Down",
        "duration": "2:38"
      },
      {
        "id": "12",
        "name": "Once",
        "duration": "3:37"
      },
      {
        "id": "13",
        "name": "Say It To Me Now",
        "duration": "2:36"
      }
    ]
  },
  {
    "albumid": "5",
    "album": "Once",
    "songs": [
      {
        "id": "1",
        "name": "Falling Slowly",
        "duration": "4:05"
      },
      {
        "id": "2",
        "name": "If You Want Me",
        "duration": "3:47"
      },
      {
        "id": "3",
        "name": "Broken Hearted Hoover Fixer Sucker Guy",
        "duration": "0:52"
      },
      {
        "id": "4",
        "name": "When Your Mind's Made Up",
        "duration": "3:42"
      },
      {
        "id": "5",
        "name": "Lies",
        "duration": "3:58"
      },
      {
        "id": "6",
        "name": "Gold",
        "duration": "3:59"
      },
      {
        "id": "7",
        "name": "The Hill",
        "duration": "4:34"
      },
      {
        "id": "8",
        "name": "Fallen From The Sky",
        "duration": "3:24"
      },
      {
        "id": "9",
        "name": "Leave",
        "duration": "2:46"
      },
      {
        "id": "10",
        "name": "Trying To Pull Myself Away",
        "duration": "3:35"
      },
      {
        "id": "11",
        "name": "All The Way Down",
        "duration": "2:38"
      },
      {
        "id": "12",
        "name": "Once",
        "duration": "3:37"
      },
      {
        "id": "13",
        "name": "Say It To Me Now",
        "duration": "2:36"
      }
    ]
  },
  {
    "albumid": "6",
    "album": "Eminem Curtain Call",
    "songs": [
      {
        "id": "1",
        "name": "My Name Is",
        "duration": "4:28"
      },
      {
        "id": "2",
        "name": "The Way I Am",
        "duration": "4:51"
      },
      {
        "id": "3",
        "name": "Lose Yourself",
        "duration": "5:21"
      },
      {
        "id": "4",
        "name": "Shake That",
        "duration": "4:34"
      },
      {
        "id": "5",
        "name": "Sing For The Moment",
        "duration": "5:40"
      },
      {
        "id": "6",
        "name": "Without Me",
        "duration": "4:47"
      },
      {
        "id": "7",
        "name": "Like Toy Soldiers",
        "duration": "4:51"
      },
      {
        "id": "8",
        "name": "The Real Slim Shady",
        "duration": "4:44"
      },
      {
        "id": "9",
        "name": "Mockingbird",
        "duration": "4:11"
      },
      {
        "id": "10",
        "name": "Guilty Conscience",
        "duration": "3:19"
      },
      {
        "id": "11",
        "name": "Cleanin' Out My Closet",
        "duration": "4:58"
      },
      {
        "id": "12",
        "name": "Just Lose It",
        "duration": "4:08"
      },
      {
        "id": "13",
        "name": "When I'm Gone",
        "duration": "4:40"
      },
      {
        "id": "14",
        "name": "Stan",
        "duration": "6:21"
      }
    ]
  },
  {
    "albumid": "7",
    "album": "Bad Meets Evil Eminem",
    "songs": [
      {
        "id": "1",
        "name": "Lighters",
        "duration": "5:21"
      },
      {
        "id": "2",
        "name": "Fast Lane",
        "duration": "3:19"
      },
      {
        "id": "3",
        "name": "Above the Law",
        "duration": "6:21"
      },
      {
        "id": "4",
        "name": "Welcome 2 Hell",
        "duration": "4:34"
      },
      {
        "id": "5",
        "name": "Take from Me",
        "duration": "4:51"
      },
      {
        "id": "6",
        "name": "The Reunion",
        "duration": "4:44"
      },
      {
        "id": "7",
        "name": "A Kiss",
        "duration": "3:19"
      },
      {
        "id": "8",
        "name": "Echo",
        "duration": "6:21"
      },
      {
        "id": "9",
        "name": "Lighters",
        "duration": "4:40"
      },
      {
        "id": "10",
        "name": "Living Proof",
        "duration": "3:49"
      },
      {
        "id": "11",
        "name": "Loud Noises",
        "duration": "3:19"
      }
    ]
  },
  {
    "albumid": "8",
    "album": "Safe Trip Home",
    "songs": [
      {
        "id": "1",
        "name": "Don't Believe in Love",
        "duration": "3:52"
      },
      {
        "id": "2",
        "name": "Quiet Times",
        "duration": "3:16"
      },
      {
        "id": "3",
        "name": "Never Want to Say It's Love",
        "duration": "3:34"
      },
      {
        "id": "4",
        "name": "Grafton Street",
        "duration": "5:56"
      },
      {
        "id": "5",
        "name": "It Comes And It Goes",
        "duration": "3:26"
      },
      {
        "id": "6",
        "name": "Look No Further",
        "duration": "3:15"
      },
      {
        "id": "7",
        "name": "Us 2 Little Gods",
        "duration": "4:48"
      },
      {
        "id": "8",
        "name": "The Day Before The Day",
        "duration": "4:12"
      },
      {
        "id": "9",
        "name": "Let's Do the Things We Normally Do",
        "duration": "4:08"
      },
      {
        "id": "10",
        "name": "Burnin Love",
        "duration": "4:10"
      },
      {
        "id": "11",
        "name": "Northern Skies",
        "duration": "8:53"
      }
    ]
  },
  {
    "albumid": "9",
    "album": "No Angel",
    "songs": [
      {
        "id": "1",
        "name": "Here With Me",
        "duration": "4:05"
      },
      {
        "id": "2",
        "name": "Hunter",
        "duration": "3:55"
      },
      {
        "id": "3",
        "name": "Don't Think Of Me",
        "duration": "4:32"
      },
      {
        "id": "4",
        "name": "My Lover's Gone",
        "duration": "4:27"
      },
      {
        "id": "5",
        "name": "All You Want",
        "duration": "3:53"
      },
      {
        "id": "6",
        "name": "Thank You",
        "duration": "3:36"
      },
      {
        "id": "7",
        "name": "Honestly Ok",
        "duration": "4:37"
      },
      {
        "id": "8",
        "name": "Slide",
        "duration": "4:50"
      },
      {
        "id": "9",
        "name": "Isobel",
        "duration": "3:55"
      },
      {
        "id": "10",
        "name": "I'm No Angel",
        "duration": "3:55"
      },
      {
        "id": "11",
        "name": "My Life",
        "duration": "2:59"
      },
      {
        "id": "12",
        "name": "Take My Hand",
        "duration": "6:50"
      }
    ]
  }
]

AlbumsActivity.java :

protected String doInBackground(String... args) {
                // Building Parameters
                List<NameValuePair> params = new ArrayList<NameValuePair>();

                // getting JSON string from URL
                String json = jsonParser.makeHttpRequest(URL_ALBUMS, "GET",
                        params);

                // Check your log cat for JSON reponse
                Log.d("Albums JSON: ", "> " + json);

                try {               
                    albums = new JSONArray(json);

                    if (albums != null) {
                        // looping through All albums
                        for (int i = 0; i < albums.length(); i++) {
                            JSONObject c = albums.getJSONObject(i);

                            // Storing each json item values in variable
                            String id = c.getString(TAG_ID);
                            String name = c.getString(TAG_NAME);
                            String songs_count = c.getString(TAG_SONGS_COUNT);

                            // creating new HashMap
                            HashMap<String, String> map = new HashMap<String, String>();

                            // adding each child node to HashMap key => value
                            map.put(TAG_ID, id);
                            map.put(TAG_NAME, name);
                            map.put(TAG_SONGS_COUNT, songs_count);

                            // adding HashList to ArrayList
                            albumsList.add(map);
                        }
                    }else{
                        Log.d("Albums: ", "null");
                    }

                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return null;
            }

TrackListActivity.java :

        protected String doInBackground(String... args) {
            // Building Parameters
            List<NameValuePair> params = new ArrayList<NameValuePair>();

            // post album id as GET parameter
            params.add(new BasicNameValuePair(TAG_ALBUM_ID, album_id));

            // getting JSON string from URL
            String json = jsonParser.makeHttpRequest(URL_ALBUMS, "GET",
                    params);

            // Check your log cat for JSON reponse
            Log.d("Track List JSON: ", json);

            try {
                albumtracks = new JSONArray(json);

                if (albumtracks != null) {
                    for (int i = 0; i < albumtracks.length(); i++) {
                    JSONObject jObj = albumtracks.getJSONObject(i);
                    String album_id = jObj.getString(TAG_ALBUM_ID);
                    album_name = jObj.getString(TAG_ALBUM);
                    albums = jObj.getJSONArray(TAG_SONGS);

                    if (albums != null) {
                        // looping through All songs
                        for (int j = 0; j < albums.length(); j++) {
                            JSONObject c = albums.getJSONObject(j);

                            // Storing each json item in variable
                            String song_id = c.getString(TAG_SONG_ID);
                            // track no - increment i value
                            String track_no = String.valueOf(j + 1);
                            String name = c.getString(TAG_NAME);
                            String duration = c.getString(TAG_DURATION);

                            // creating new HashMap
                            HashMap<String, String> map = new HashMap<String, String>();

                            // adding each child node to HashMap key => value
                            map.put(TAG_ALBUM_ID, album_id);
                            map.put(TAG_SONG_ID, song_id);
                            map.put("track_no", track_no + ".");
                            map.put(TAG_NAME, name);
                            map.put(TAG_DURATION, duration);

                            // adding HashList to ArrayList
                            tracksList.add(map);
                        }
                    } else {
                        Log.d("Albums: ", "null");
                    }
                }

            }
                } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;

        }   

参考までに、PHP なしでこれを実行できることを願っています。前もって感謝します!

4

2 に答える 2

0

マッピングを処理するライブラリを使用するだけです。ジャクソン、または以下の例では、GSON がこれを簡単にします。

import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import java.util.*;

public class Main {

  public static void main(String[] args) {

    Gson gson = new Gson();

    List<Album> albums = gson.fromJson(albumsJson, new TypeToken<ArrayList<Album>>(){}.getType());

    for (Album album : albums) {
      System.out.println(album);
    }

    List<SongList> songs = gson.fromJson(songListJson, new TypeToken<ArrayList<SongList>>(){}.getType());

    for (SongList song : songs) {
      System.out.println(song);
    }
  }

  class Album {

    @SerializedName("albumid") String albumId;
    String name;
    @SerializedName("songs_count") String songsCount;

    @Override
    public String toString() {
      return "Album{" +
          "albumId='" + albumId + '\'' +
          ", name='" + name + '\'' +
          ", songsCount='" + songsCount + '\'' +
          '}';
    }
  }

  class SongList {

    @SerializedName("albumid") String albumId;
    String album;
    List<Song> songs;

    @Override
    public String toString() {
      return "SongList{" +
          "albumId='" + albumId + '\'' +
          ", album='" + album + '\'' +
          ", songs=" + songs +
          '}';
    }
  }

  class Song {

    String id;
    String name;
    String duration;

    @Override
    public String toString() {
      return "Song{" +
          "id='" + id + '\'' +
          ", name='" + name + '\'' +
          ", duration='" + duration + '\'' +
          '}';
    }
  }

  static String albumsJson = "[\n" +
      "    {   \"albumid\": \"1\",\n" +
      "        \"name\":\"127 Hours\",\n" +
      "        \"songs_count\":\"14\"\n" +
      "    },\n" +
      "    {   \"albumid\": \"2\",\n" +
      "        \"name\":\"Adele 21\",\n" +
      "        \"songs_count\":\"11\"\n" +
      "    },\n" +
      "    {   \"albumid\": \"3\",\n" +
      "        \"name\":\"Lana Del Rey - Born to Die\",\n" +
      "        \"songs_count\":\"12\"\n" +
      "    },\n" +
      "    {   \"albumid\": \"4\",\n" +
      "        \"name\":\"Once\",\n" +
      "        \"songs_count\":\"13\"\n" +
      "    },\n" +
      "    {   \"albumid\": \"5\",\n" +
      "        \"name\":\"Away We Go\",\n" +
      "        \"songs_count\":\"13\"\n" +
      "    },\n" +
      "    {   \"albumid\": \"6\",\n" +
      "        \"name\":\"Eminem Curtain Call\",\n" +
      "        \"songs_count\":\"14\"\n" +
      "    },\n" +
      "    {   \"albumid\": \"7\",\n" +
      "        \"name\":\"Bad Meets Evil Eminem\",\n" +
      "        \"songs_count\":\"11\"\n" +
      "    },\n" +
      "    {   \"albumid\": \"8\",\n" +
      "        \"name\":\"Safe Trip Home\",\n" +
      "        \"songs_count\":\"11\"\n" +
      "    },\n" +
      "    {   \"albumid\": \"9\",\n" +
      "        \"name\":\"No Angel\",\n" +
      "        \"songs_count\":\"12\"\n" +
      "    }\n" +
      "]";

  static String songListJson = "[\n" +
      "  {\n" +
      "    \"albumid\": \"1\",\n" +
      "    \"album\": \"127 Hours\",\n" +
      "    \"songs\": [\n" +
      "      {\n" +
      "        \"id\": \"1\",\n" +
      "        \"name\": \"Never Hear Surf Music Again\",\n" +
      "        \"duration\": \"5:52\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"2\",\n" +
      "        \"name\": \"The Canyon\",\n" +
      "        \"duration\": \"3:01\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"3\",\n" +
      "        \"name\": \"Liberation Begins\",\n" +
      "        \"duration\": \"2:14\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"4\",\n" +
      "        \"name\": \"Touch of the Sun\",\n" +
      "        \"duration\": \"4:39\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"5\",\n" +
      "        \"name\": \"Lovely Day\",\n" +
      "        \"duration\": \"4:16\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"6\",\n" +
      "        \"name\": \"Ca Plane Pour Moi\",\n" +
      "        \"duration\": \"3:00\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"7\",\n" +
      "        \"name\": \"Liberation In A Dream\",\n" +
      "        \"duration\": \"4:06\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"8\",\n" +
      "        \"name\": \"If You Love Me (Really Love Me)\",\n" +
      "        \"duration\": \"3:27\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"9\",\n" +
      "        \"name\": \"Acid Darbari\",\n" +
      "        \"duration\": \"4:21\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"10\",\n" +
      "        \"name\": \"R.I.P.\",\n" +
      "        \"duration\": \"5:11\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"11\",\n" +
      "        \"name\": \"Festival\",\n" +
      "        \"duration\": \"9:26\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"12\",\n" +
      "        \"name\": \"If I Rise\",\n" +
      "        \"duration\": \"4:38\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"13\",\n" +
      "        \"name\": \"Liberation\",\n" +
      "        \"duration\": \"3:11\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"14\",\n" +
      "        \"name\": \"Nocturne No. 2 in E flat\",\n" +
      "        \"duration\": \"4:01\"\n" +
      "      }\n" +
      "    ]\n" +
      "  },\n" +
      "  {\n" +
      "    \"albumid\": \"2\",\n" +
      "    \"album\": \"Adele 21\",\n" +
      "    \"songs\": [\n" +
      "      {\n" +
      "        \"id\": \"1\",\n" +
      "        \"name\": \"Rolling In The Deep\",\n" +
      "        \"duration\": \"03:48\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"2\",\n" +
      "        \"name\": \"Rumour Has It\",\n" +
      "        \"duration\": \"03:43\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"3\",\n" +
      "        \"name\": \"Turning Tables\",\n" +
      "        \"duration\": \"04:10\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"4\",\n" +
      "        \"name\": \"Don\\u2019t You Remember\",\n" +
      "        \"duration\": \"04:03\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"5\",\n" +
      "        \"name\": \"Set Fire To The Rain\",\n" +
      "        \"duration\": \"04:02\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"6\",\n" +
      "        \"name\": \"He Won\\u2019t Go\",\n" +
      "        \"duration\": \"04:38\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"7\",\n" +
      "        \"name\": \"Take It All\",\n" +
      "        \"duration\": \"03:48\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"8\",\n" +
      "        \"name\": \"I\\u2019ll Be Waiting\",\n" +
      "        \"duration\": \"04:01\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"9\",\n" +
      "        \"name\": \"One And Only\",\n" +
      "        \"duration\": \"05:48\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"10\",\n" +
      "        \"name\": \"Lovesong\",\n" +
      "        \"duration\": \"05:16\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"11\",\n" +
      "        \"name\": \"Someone Like You\",\n" +
      "        \"duration\": \"04:45\"\n" +
      "      }\n" +
      "    ]\n" +
      "  },\n" +
      "  {\n" +
      "    \"albumid\": \"3\",\n" +
      "    \"album\": \"Lana Del Rey - Born to Die\",\n" +
      "    \"songs\": [\n" +
      "      {\n" +
      "        \"id\": \"1\",\n" +
      "        \"name\": \"Born to Die\",\n" +
      "        \"duration\": \"4:46\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"2\",\n" +
      "        \"name\": \"Off to the Races\",\n" +
      "        \"duration\": \"5:00\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"3\",\n" +
      "        \"name\": \"Blue Jeans\",\n" +
      "        \"duration\": \"3:29\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"4\",\n" +
      "        \"name\": \"Video Games\",\n" +
      "        \"duration\": \"4:42\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"5\",\n" +
      "        \"name\": \"Diet Mountain Dew\",\n" +
      "        \"duration\": \"3:43\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"6\",\n" +
      "        \"name\": \"National Anthem\",\n" +
      "        \"duration\": \"3:51\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"7\",\n" +
      "        \"name\": \"Dark Paradise\",\n" +
      "        \"duration\": \"4:03\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"8\",\n" +
      "        \"name\": \"Radio\",\n" +
      "        \"duration\": \"3:35\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": 9,\n" +
      "        \"name\": \"Carmen\",\n" +
      "        \"duration\": \"4:09\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"10\",\n" +
      "        \"name\": \"Million Dollar Man\",\n" +
      "        \"duration\": \"3:50\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"11\",\n" +
      "        \"name\": \"Summertime Sadness\",\n" +
      "        \"duration\": \"4:25\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"12\",\n" +
      "        \"name\": \"This Is What Makes Us Girls\",\n" +
      "        \"duration\": \"4:00\"\n" +
      "      }\n" +
      "    ]\n" +
      "  },\n" +
      "  {\n" +
      "    \"albumid\": \"4\",\n" +
      "    \"album\": \"Once\",\n" +
      "    \"songs\": [\n" +
      "      {\n" +
      "        \"id\": \"1\",\n" +
      "        \"name\": \"Falling Slowly\",\n" +
      "        \"duration\": \"4:05\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"2\",\n" +
      "        \"name\": \"If You Want Me\",\n" +
      "        \"duration\": \"3:47\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"3\",\n" +
      "        \"name\": \"Broken Hearted Hoover Fixer Sucker Guy\",\n" +
      "        \"duration\": \"0:52\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"4\",\n" +
      "        \"name\": \"When Your Mind's Made Up\",\n" +
      "        \"duration\": \"3:42\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"5\",\n" +
      "        \"name\": \"Lies\",\n" +
      "        \"duration\": \"3:58\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"6\",\n" +
      "        \"name\": \"Gold\",\n" +
      "        \"duration\": \"3:59\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"7\",\n" +
      "        \"name\": \"The Hill\",\n" +
      "        \"duration\": \"4:34\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"8\",\n" +
      "        \"name\": \"Fallen From The Sky\",\n" +
      "        \"duration\": \"3:24\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"9\",\n" +
      "        \"name\": \"Leave\",\n" +
      "        \"duration\": \"2:46\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"10\",\n" +
      "        \"name\": \"Trying To Pull Myself Away\",\n" +
      "        \"duration\": \"3:35\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"11\",\n" +
      "        \"name\": \"All The Way Down\",\n" +
      "        \"duration\": \"2:38\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"12\",\n" +
      "        \"name\": \"Once\",\n" +
      "        \"duration\": \"3:37\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"13\",\n" +
      "        \"name\": \"Say It To Me Now\",\n" +
      "        \"duration\": \"2:36\"\n" +
      "      }\n" +
      "    ]\n" +
      "  },\n" +
      "  {\n" +
      "    \"albumid\": \"5\",\n" +
      "    \"album\": \"Once\",\n" +
      "    \"songs\": [\n" +
      "      {\n" +
      "        \"id\": \"1\",\n" +
      "        \"name\": \"Falling Slowly\",\n" +
      "        \"duration\": \"4:05\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"2\",\n" +
      "        \"name\": \"If You Want Me\",\n" +
      "        \"duration\": \"3:47\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"3\",\n" +
      "        \"name\": \"Broken Hearted Hoover Fixer Sucker Guy\",\n" +
      "        \"duration\": \"0:52\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"4\",\n" +
      "        \"name\": \"When Your Mind's Made Up\",\n" +
      "        \"duration\": \"3:42\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"5\",\n" +
      "        \"name\": \"Lies\",\n" +
      "        \"duration\": \"3:58\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"6\",\n" +
      "        \"name\": \"Gold\",\n" +
      "        \"duration\": \"3:59\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"7\",\n" +
      "        \"name\": \"The Hill\",\n" +
      "        \"duration\": \"4:34\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"8\",\n" +
      "        \"name\": \"Fallen From The Sky\",\n" +
      "        \"duration\": \"3:24\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"9\",\n" +
      "        \"name\": \"Leave\",\n" +
      "        \"duration\": \"2:46\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"10\",\n" +
      "        \"name\": \"Trying To Pull Myself Away\",\n" +
      "        \"duration\": \"3:35\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"11\",\n" +
      "        \"name\": \"All The Way Down\",\n" +
      "        \"duration\": \"2:38\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"12\",\n" +
      "        \"name\": \"Once\",\n" +
      "        \"duration\": \"3:37\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"13\",\n" +
      "        \"name\": \"Say It To Me Now\",\n" +
      "        \"duration\": \"2:36\"\n" +
      "      }\n" +
      "    ]\n" +
      "  },\n" +
      "  {\n" +
      "    \"albumid\": \"6\",\n" +
      "    \"album\": \"Eminem Curtain Call\",\n" +
      "    \"songs\": [\n" +
      "      {\n" +
      "        \"id\": \"1\",\n" +
      "        \"name\": \"My Name Is\",\n" +
      "        \"duration\": \"4:28\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"2\",\n" +
      "        \"name\": \"The Way I Am\",\n" +
      "        \"duration\": \"4:51\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"3\",\n" +
      "        \"name\": \"Lose Yourself\",\n" +
      "        \"duration\": \"5:21\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"4\",\n" +
      "        \"name\": \"Shake That\",\n" +
      "        \"duration\": \"4:34\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"5\",\n" +
      "        \"name\": \"Sing For The Moment\",\n" +
      "        \"duration\": \"5:40\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"6\",\n" +
      "        \"name\": \"Without Me\",\n" +
      "        \"duration\": \"4:47\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"7\",\n" +
      "        \"name\": \"Like Toy Soldiers\",\n" +
      "        \"duration\": \"4:51\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"8\",\n" +
      "        \"name\": \"The Real Slim Shady\",\n" +
      "        \"duration\": \"4:44\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"9\",\n" +
      "        \"name\": \"Mockingbird\",\n" +
      "        \"duration\": \"4:11\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"10\",\n" +
      "        \"name\": \"Guilty Conscience\",\n" +
      "        \"duration\": \"3:19\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"11\",\n" +
      "        \"name\": \"Cleanin' Out My Closet\",\n" +
      "        \"duration\": \"4:58\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"12\",\n" +
      "        \"name\": \"Just Lose It\",\n" +
      "        \"duration\": \"4:08\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"13\",\n" +
      "        \"name\": \"When I'm Gone\",\n" +
      "        \"duration\": \"4:40\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"14\",\n" +
      "        \"name\": \"Stan\",\n" +
      "        \"duration\": \"6:21\"\n" +
      "      }\n" +
      "    ]\n" +
      "  },\n" +
      "  {\n" +
      "    \"albumid\": \"7\",\n" +
      "    \"album\": \"Bad Meets Evil Eminem\",\n" +
      "    \"songs\": [\n" +
      "      {\n" +
      "        \"id\": \"1\",\n" +
      "        \"name\": \"Lighters\",\n" +
      "        \"duration\": \"5:21\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"2\",\n" +
      "        \"name\": \"Fast Lane\",\n" +
      "        \"duration\": \"3:19\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"3\",\n" +
      "        \"name\": \"Above the Law\",\n" +
      "        \"duration\": \"6:21\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"4\",\n" +
      "        \"name\": \"Welcome 2 Hell\",\n" +
      "        \"duration\": \"4:34\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"5\",\n" +
      "        \"name\": \"Take from Me\",\n" +
      "        \"duration\": \"4:51\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"6\",\n" +
      "        \"name\": \"The Reunion\",\n" +
      "        \"duration\": \"4:44\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"7\",\n" +
      "        \"name\": \"A Kiss\",\n" +
      "        \"duration\": \"3:19\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"8\",\n" +
      "        \"name\": \"Echo\",\n" +
      "        \"duration\": \"6:21\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"9\",\n" +
      "        \"name\": \"Lighters\",\n" +
      "        \"duration\": \"4:40\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"10\",\n" +
      "        \"name\": \"Living Proof\",\n" +
      "        \"duration\": \"3:49\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"11\",\n" +
      "        \"name\": \"Loud Noises\",\n" +
      "        \"duration\": \"3:19\"\n" +
      "      }\n" +
      "    ]\n" +
      "  },\n" +
      "  {\n" +
      "    \"albumid\": \"8\",\n" +
      "    \"album\": \"Safe Trip Home\",\n" +
      "    \"songs\": [\n" +
      "      {\n" +
      "        \"id\": \"1\",\n" +
      "        \"name\": \"Don't Believe in Love\",\n" +
      "        \"duration\": \"3:52\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"2\",\n" +
      "        \"name\": \"Quiet Times\",\n" +
      "        \"duration\": \"3:16\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"3\",\n" +
      "        \"name\": \"Never Want to Say It's Love\",\n" +
      "        \"duration\": \"3:34\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"4\",\n" +
      "        \"name\": \"Grafton Street\",\n" +
      "        \"duration\": \"5:56\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"5\",\n" +
      "        \"name\": \"It Comes And It Goes\",\n" +
      "        \"duration\": \"3:26\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"6\",\n" +
      "        \"name\": \"Look No Further\",\n" +
      "        \"duration\": \"3:15\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"7\",\n" +
      "        \"name\": \"Us 2 Little Gods\",\n" +
      "        \"duration\": \"4:48\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"8\",\n" +
      "        \"name\": \"The Day Before The Day\",\n" +
      "        \"duration\": \"4:12\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"9\",\n" +
      "        \"name\": \"Let's Do the Things We Normally Do\",\n" +
      "        \"duration\": \"4:08\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"10\",\n" +
      "        \"name\": \"Burnin Love\",\n" +
      "        \"duration\": \"4:10\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"11\",\n" +
      "        \"name\": \"Northern Skies\",\n" +
      "        \"duration\": \"8:53\"\n" +
      "      }\n" +
      "    ]\n" +
      "  },\n" +
      "  {\n" +
      "    \"albumid\": \"9\",\n" +
      "    \"album\": \"No Angel\",\n" +
      "    \"songs\": [\n" +
      "      {\n" +
      "        \"id\": \"1\",\n" +
      "        \"name\": \"Here With Me\",\n" +
      "        \"duration\": \"4:05\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"2\",\n" +
      "        \"name\": \"Hunter\",\n" +
      "        \"duration\": \"3:55\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"3\",\n" +
      "        \"name\": \"Don't Think Of Me\",\n" +
      "        \"duration\": \"4:32\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"4\",\n" +
      "        \"name\": \"My Lover's Gone\",\n" +
      "        \"duration\": \"4:27\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"5\",\n" +
      "        \"name\": \"All You Want\",\n" +
      "        \"duration\": \"3:53\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"6\",\n" +
      "        \"name\": \"Thank You\",\n" +
      "        \"duration\": \"3:36\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"7\",\n" +
      "        \"name\": \"Honestly Ok\",\n" +
      "        \"duration\": \"4:37\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"8\",\n" +
      "        \"name\": \"Slide\",\n" +
      "        \"duration\": \"4:50\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"9\",\n" +
      "        \"name\": \"Isobel\",\n" +
      "        \"duration\": \"3:55\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"10\",\n" +
      "        \"name\": \"I'm No Angel\",\n" +
      "        \"duration\": \"3:55\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"11\",\n" +
      "        \"name\": \"My Life\",\n" +
      "        \"duration\": \"2:59\"\n" +
      "      },\n" +
      "      {\n" +
      "        \"id\": \"12\",\n" +
      "        \"name\": \"Take My Hand\",\n" +
      "        \"duration\": \"6:50\"\n" +
      "      }\n" +
      "    ]\n" +
      "  }\n" +
      "]";
}

このMainクラスを実行すると、以下が生成されます。

Album{albumId='1', name='127時間', songCount='14'}
Album{albumId='2', name='Adele 21', songCount='11'}
Album{albumId='3', name='ラナ・デル・レイ - ボーン・トゥ・ダイ', songCount='12'}
Album{albumId='4', name='Once', songCount='13'}
Album{albumId='5', name='Away We Go', songCount='13'}
Album{albumId='6', name='エミネム カーテンコール', songCount='14'}
Album{albumId='7', name='Bad Meets Evil Eminem', songCount='11'}
Album{albumId='8', name='Safe Trip Home', songCount='11'}
Album{albumId='9', name='No Angel', songCount='12'}
SongList{albumId='1', album='127 Hours', song=[Song{id='1', name='Never Hear Surf Music Again', duration='5:52'}, Song{id=' 2', name='キャニオン', duration='3:01'}, Song{id='3', name='Liberation Begins', duration='2:14'}, Song{id='4' , name='Touch of the Sun', duration='4:39'}, Song{id='5', name='ラブリーデイ', duration='4:16'}, Song{id='6' 、name='Ca Plane Pour Moi'、duration='3:00'}、Song{id='7'、name='Liberation In A Dream'、duration='4:06'}、Song{id=' 8', name='If You Love Me (Really Love Me)', duration='3:27'}, Song{id='9', name='Acid Darbari', duration='4:21'},曲{id='10', name='RIP',duration='5:11'}, Song{id='11', name='Festival', duration='9:26'}, Song{id='12', name='If I Rise', duration= '4:38'}, Song{id='13', name='解放', duration='3:11'}, Song{id='14', name='ノクターン第2番ホ長調', duration='4:01'}]}
SongList{albumId='2', album='Adele 21', 曲=[Song{id='1', name='Rolling In The Deep', duration='03:48'}, Song{id='2 ', name='Rumour Has It', duration='03:43'}, Song{id='3', name='Turning Tables', duration='04:10'}, Song{id='4' , name='Don't You Remember', duration='04:03'}, Song{id='5', name='Set Fire To The Rain', duration='04:02'}, ソング{id ='6', name='彼は行かない', duration='04:38'}, Song{id='7', name='Take It All', duration='03:48'}, Song {id='8', name='I'll Be Waiting', duration='04:01'}, Song{id='9', name='One And Only', duration='05:48'} , Song{id='10', name='ラブソング', duration='05:16'},Song{id='11', name='Someone Like You', duration='04:45'}]}
SongList{albumId='3', album='Lana Del Rey - Born to Die', song=[Song{id='1', name='Born to Die', duration='4:46'}, Song{ id='2', name='オフ トゥ ザ レース', duration='5:00'}, Song{id='3', name='ブルー ジーンズ', duration='3:29'}, Song{ id='4', name='ビデオ ゲーム', duration='4:42'}, Song{id='5', name='ダイエット マウンテン デュー', duration='3:43'}, Song{id ='6', name='国歌', duration='3:51'}, Song{id='7', name='Dark Paradise', duration='4:03'}, Song{id=' 8', name='ラジオ', duration='3:35'}, Song{id='9', name='Carmen', duration='4:09'}, Song{id='10', name ='ミリオン ダラー マン', duration='3:50'}, Song{id='11', name='夏の悲しみ', duration='4:25'}, Song{id='12', name='これが私たちを女の子にするもの', duration='4:00'}]}
...
于 2013-09-12T07:29:47.817 に答える