多次元配列を作成したい。これを2つに変えたいとしましょう:
{
"fighters": [
{
"name": "Muhammad Ali",
"nickname": "The Greatest",
"image": "http://upload.wikimedia.org/wikipedia/commons/1/13/Clyde_The_Bulldog.jpg"
},
{
"name": "Chuck Liddell",
"nickname": "The Iceman",
"image": "http://images.pictureshunt.com/pics/s/saint_bernard-12924.jpg"
},
{
"name": "Rocky Marciano",
"nickname": "The Brockton Blockbuster",
"image": "http://www.goodhousekeeping.com/cm/goodhousekeeping/images/IO/alaskan-malamute-fb.jpg"
},
{
"name": "Randy Couture",
"nickname": "The Natural",
"image": "http://slog.thestranger.com/files/2006/09/bigdog.jpg"
},
{
"name": "Fedor Emelianenko",
"nickname": "The Last Emperor",
"image": "http://affordablehousinginstitute.org/blogs/us/wp-content/uploads/small_dog_on_big_dog.jpg"
},
{
"name": "Jon Jones",
"nickname": "Bones"
},
{
"name": "George Foreman",
"nickname": "Big George"
},
{
"name": "Wanderlei Silva",
"nickname": "The Axe Murderer"
},
{
"name": "Gearges St. Pierre",
"nickname": "Rush"
},
{
"name": "Manny Pacquiao",
"nickname": "Pac-Man"
}
]
}
最初の 5 つの項目を「dogs」という配列に入れ、残りの 5 つの項目を「noDogs」という配列に入れたいとします。どうすればいいですか?