-2

json形式のwhoidデータがあります

まず、長文ですみません。郡名とwhoidのリストが欲しいです

例: 英国 - 23424975 ただし、これができない場合もあります。

<?php
$json = '[
{
"name": "United Kingdom",
"woeid": 23424975,
"placeType": {
"name": "Country",
"code": 12
},
"country": "United Kingdom",
"url": "http://where.yahooapis.com/v1/place/23424975",
"countryCode": "GB",
"parentid": 1
},
{
"name": "Miami",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2450022,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2450022",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Sendai",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 1118129,
"country": "Japan",
"url": "http://where.yahooapis.com/v1/place/1118129",
"countryCode": "JP",
"parentid": 23424856
},
{
"name": "Nigeria",
"woeid": 23424908,
"placeType": {
"name": "Country",
"code": 12
},
"country": "Nigeria",
"url": "http://where.yahooapis.com/v1/place/23424908",
"countryCode": "NG",
"parentid": 1
},
{
"name": "New Orleans",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2458833,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2458833",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Bangalore",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2295420,
"country": "India",
"url": "http://where.yahooapis.com/v1/place/2295420",
"countryCode": "IN",
"parentid": 23424848
},
{
"name": "Osaka",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 15015370,
"country": "Japan",
"url": "http://where.yahooapis.com/v1/place/15015370",
"countryCode": "JP",
"parentid": 23424856
},
{
"name": "Berlin",
"woeid": 638242,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Germany",
"url": "http://where.yahooapis.com/v1/place/638242",
"countryCode": "DE",
"parentid": 23424829
},
{
"name": "South Africa",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424942,
"country": "South Africa",
"url": "http://where.yahooapis.com/v1/place/23424942",
"countryCode": "ZA",
"parentid": 1
},
{
"name": "Salt Lake City",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2487610,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2487610",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Netherlands",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424909,
"country": "Netherlands",
"url": "http://where.yahooapis.com/v1/place/23424909",
"countryCode": "NL",
"parentid": 1
},
{
"name": "Canada",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424775,
"country": "Canada",
"url": "http://where.yahooapis.com/v1/place/23424775",
"countryCode": "CA",
"parentid": 1
},
{
"name": "Jakarta",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 1047378,
"country": "Indonesia",
"url": "http://where.yahooapis.com/v1/place/1047378",
"countryCode": "ID",
"parentid": 23424846
},
{
"name": "Columbus",
"woeid": 2383660,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2383660",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Worldwide",
"placeType": {
"name": "Supername",
"code": 19
},
"woeid": 1,
"country": "",
"url": "http://where.yahooapis.com/v1/place/1",
"countryCode": null,
"parentid": 0
},
{
"name": "Providence",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2477058,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2477058",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "United States",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424977,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/23424977",
"countryCode": "US",
"parentid": 1
},
{
"name": "Kyoto",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 15015372,
"country": "Japan",
"url": "http://where.yahooapis.com/v1/place/15015372",
"countryCode": "JP",
"parentid": 23424856
},
{
"name": "Chicago",
"woeid": 2379574,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2379574",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Caracas",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 395269,
"country": "Venezuela",
"url": "http://where.yahooapis.com/v1/place/395269",
"countryCode": "VE",
"parentid": 23424982
},
{
"name": "Kuala Lumpur",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 1154781,
"country": "Malaysia",
"url": "http://where.yahooapis.com/v1/place/1154781",
"countryCode": "MY",
"parentid": 23424901
},
{
"name": "Houston",
"woeid": 2424766,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2424766",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Maracaibo",
"woeid": 395270,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Venezuela",
"url": "http://where.yahooapis.com/v1/place/395270",
"countryCode": "VE",
"parentid": 23424982
},
{
"name": "Washington",
"woeid": 2514815,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2514815",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Portland",
"woeid": 2475687,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2475687",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Sacramento",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2486340,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2486340",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Bandung",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 1047180,
"country": "Indonesia",
"url": "http://where.yahooapis.com/v1/place/1047180",
"countryCode": "ID",
"parentid": 23424846
},
{
"name": "Jackson",
"woeid": 2428184,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2428184",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Memphis",
"woeid": 2449323,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2449323",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Chennai",
"woeid": 2295424,
"placeType": {
"name": "Town",
"code": 7
},
"country": "India",
"url": "http://where.yahooapis.com/v1/place/2295424",
"countryCode": "IN",
"parentid": 23424848
},
{
"name": "Indonesia",
"woeid": 23424846,
"placeType": {
"name": "Country",
"code": 12
},
"country": "Indonesia",
"url": "http://where.yahooapis.com/v1/place/23424846",
"countryCode": "ID",
"parentid": 1
},
{
"name": "Delhi",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 20070458,
"country": "India",
"url": "http://where.yahooapis.com/v1/place/20070458",
"countryCode": "IN",
"parentid": 23424848
},
{
"name": "Ankara",
"woeid": 2343732,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Turkey",
"url": "http://where.yahooapis.com/v1/place/2343732",
"countryCode": "TR",
"parentid": 23424969
},
{
"name": "Paris",
"woeid": 615702,
"placeType": {
"name": "Town",
"code": 7
},
"country": "France",
"url": "http://where.yahooapis.com/v1/place/615702",
"countryCode": "FR",
"parentid": 23424819
},
{
"name": "Valencia",
"woeid": 395272,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Venezuela",
"url": "http://where.yahooapis.com/v1/place/395272",
"countryCode": "VE",
"parentid": 23424982
},
{
"name": "Tampa",
"woeid": 2503863,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2503863",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Argentina",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424747,
"country": "Argentina",
"url": "http://where.yahooapis.com/v1/place/23424747",
"countryCode": "AR",
"parentid": 1
},
{
"name": "Tokyo",
"woeid": 1118370,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Japan",
"url": "http://where.yahooapis.com/v1/place/1118370",
"countryCode": "JP",
"parentid": 23424856
},
{
"name": "Singapore",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424948,
"country": "Singapore",
"url": "http://where.yahooapis.com/v1/place/23424948",
"countryCode": "SG",
"parentid": 1
},
{
"name": "Venezuela",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424982,
"country": "Venezuela",
"url": "http://where.yahooapis.com/v1/place/23424982",
"countryCode": "VE",
"parentid": 1
},
{
"name": "Moscow",
"woeid": 2122265,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Russia",
"url": "http://where.yahooapis.com/v1/place/2122265",
"countryCode": "RU",
"parentid": 23424936
},
{
"name": "India",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424848,
"country": "India",
"url": "http://where.yahooapis.com/v1/place/23424848",
"countryCode": "IN",
"parentid": 1
},
{
"name": "Australia",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424748,
"country": "Australia",
"url": "http://where.yahooapis.com/v1/place/23424748",
"countryCode": "AU",
"parentid": 1
},
{
"name": "Austin",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2357536,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2357536",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Buenos Aires",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 468739,
"country": "Argentina",
"url": "http://where.yahooapis.com/v1/place/468739",
"countryCode": "AR",
"parentid": 23424747
},
{
"name": "New Zealand",
"woeid": 23424916,
"placeType": {
"name": "Country",
"code": 12
},
"country": "New Zealand",
"url": "http://where.yahooapis.com/v1/place/23424916",
"countryCode": "NZ",
"parentid": 1
},
{
"name": "Chile",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424782,
"country": "Chile",
"url": "http://where.yahooapis.com/v1/place/23424782",
"countryCode": "CL",
"parentid": 1
},
{
"name": "Fukuoka",
"woeid": 1117099,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Japan",
"url": "http://where.yahooapis.com/v1/place/1117099",
"countryCode": "JP",
"parentid": 23424856
},
{
"name": "Spain",
"woeid": 23424950,
"placeType": {
"name": "Country",
"code": 12
},
"country": "Spain",
"url": "http://where.yahooapis.com/v1/place/23424950",
"countryCode": "ES",
"parentid": 1
},
{
"name": "Santo Domingo",
"woeid": 76456,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Dominican Republic",
"url": "http://where.yahooapis.com/v1/place/76456",
"countryCode": "DO",
"parentid": 23424800
},
{
"name": "St. Louis",
"woeid": 2486982,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2486982",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Barcelona",
"woeid": 753692,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Spain",
"url": "http://where.yahooapis.com/v1/place/753692",
"countryCode": "ES",
"parentid": 23424950
},
{
"name": "Manila",
"woeid": 1199477,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Philippines",
"url": "http://where.yahooapis.com/v1/place/1199477",
"countryCode": "PH",
"parentid": 23424934
},
{
"name": "Peru",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424919,
"country": "Peru",
"url": "http://where.yahooapis.com/v1/place/23424919",
"countryCode": "PE",
"parentid": 1
},
{
"name": "Raleigh",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2478307,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2478307",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Dallas-Ft. Worth",
"woeid": 2388929,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2388929",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Sydney",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 1105779,
"country": "Australia",
"url": "http://where.yahooapis.com/v1/place/1105779",
"countryCode": "AU",
"parentid": 23424748
},
{
"name": "France",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424819,
"country": "France",
"url": "http://where.yahooapis.com/v1/place/23424819",
"countryCode": "FR",
"parentid": 1
},
{
"name": "Manchester",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 28218,
"country": "United Kingdom",
"url": "http://where.yahooapis.com/v1/place/28218",
"countryCode": "GB",
"parentid": 23424975
},
{
"name": "San Diego",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2487889,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2487889",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Italy",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424853,
"country": "Italy",
"url": "http://where.yahooapis.com/v1/place/23424853",
"countryCode": "IT",
"parentid": 1
},
{
"name": "San Francisco",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2487956,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2487956",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Minneapolis",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2452078,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2452078",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Sweden",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424954,
"country": "Sweden",
"url": "http://where.yahooapis.com/v1/place/23424954",
"countryCode": "SE",
"parentid": 1
},
{
"name": "Sapporo",
"woeid": 1118108,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Japan",
"url": "http://where.yahooapis.com/v1/place/1118108",
"countryCode": "JP",
"parentid": 23424856
},
{
"name": "Nashville",
"woeid": 2457170,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2457170",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Colombia",
"woeid": 23424787,
"placeType": {
"name": "Country",
"code": 12
},
"country": "Colombia",
"url": "http://where.yahooapis.com/v1/place/23424787",
"countryCode": "CO",
"parentid": 1
},
{
"name": "New Haven",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2458410,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2458410",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Monterrey",
"woeid": 134047,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Mexico",
"url": "http://where.yahooapis.com/v1/place/134047",
"countryCode": "MX",
"parentid": 23424900
},
{
"name": "Quezon City",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 1199682,
"country": "Philippines",
"url": "http://where.yahooapis.com/v1/place/1199682",
"countryCode": "PH",
"parentid": 23424934
},
{
"name": "Pakistan",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424922,
"country": "Pakistan",
"url": "http://where.yahooapis.com/v1/place/23424922",
"countryCode": "PK",
"parentid": 1
},
{
"name": "Amsterdam",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 727232,
"country": "Netherlands",
"url": "http://where.yahooapis.com/v1/place/727232",
"countryCode": "NL",
"parentid": 23424909
},
{
"name": "New York",
"woeid": 2459115,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2459115",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Novosibirsk",
"woeid": 2122541,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Russia",
"url": "http://where.yahooapis.com/v1/place/2122541",
"countryCode": "RU",
"parentid": 23424936
},
{
"name": "Las Vegas",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2436704,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2436704",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Klang",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 1154726,
"country": "Malaysia",
"url": "http://where.yahooapis.com/v1/place/1154726",
"countryCode": "MY",
"parentid": 23424901
},
{
"name": "Japan",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424856,
"country": "Japan",
"url": "http://where.yahooapis.com/v1/place/23424856",
"countryCode": "JP",
"parentid": 1
},
{
"name": "Norfolk",
"woeid": 2460389,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2460389",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Ahmedabad",
"woeid": 2295402,
"placeType": {
"name": "Town",
"code": 7
},
"country": "India",
"url": "http://where.yahooapis.com/v1/place/2295402",
"countryCode": "IN",
"parentid": 23424848
},
{
"name": "Denver",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2391279,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2391279",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Cincinnati",
"woeid": 2380358,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2380358",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Harrisburg",
"woeid": 2418046,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2418046",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Stockholm",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 906057,
"country": "Sweden",
"url": "http://where.yahooapis.com/v1/place/906057",
"countryCode": "SE",
"parentid": 23424954
},
{
"name": "Bogotá",
"woeid": 368148,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Colombia",
"url": "http://where.yahooapis.com/v1/place/368148",
"countryCode": "CO",
"parentid": 23424787
},
{
"name": "Baton Rouge",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2359991,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2359991",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Montreal",
"woeid": 3534,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Canada",
"url": "http://where.yahooapis.com/v1/place/3534",
"countryCode": "CA",
"parentid": 23424775
},
{
"name": "Brasília",
"woeid": 455819,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Brazil",
"url": "http://where.yahooapis.com/v1/place/455819",
"countryCode": "BR",
"parentid": 23424768
},
{
"name": "Baltimore",
"woeid": 2358820,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2358820",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Richmond",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2480894,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2480894",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Barquisimeto",
"woeid": 468382,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Venezuela",
"url": "http://where.yahooapis.com/v1/place/468382",
"countryCode": "VE",
"parentid": 23424982
},
{
"name": "Santiago",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 349859,
"country": "Chile",
"url": "http://where.yahooapis.com/v1/place/349859",
"countryCode": "CL",
"parentid": 23424782
},
{
"name": "Bekasi",
"woeid": 1030077,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Indonesia",
"url": "http://where.yahooapis.com/v1/place/1030077",
"countryCode": "ID",
"parentid": 23424846
},
{
"name": "San Antonio",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2487796,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2487796",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Pittsburgh",
"woeid": 2473224,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2473224",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Orlando",
"woeid": 2466256,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2466256",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Glasgow",
"woeid": 21125,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United Kingdom",
"url": "http://where.yahooapis.com/v1/place/21125",
"countryCode": "GB",
"parentid": 23424975
},
{
"name": "Detroit",
"woeid": 2391585,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2391585",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Dublin",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 560743,
"country": "Ireland",
"url": "http://where.yahooapis.com/v1/place/560743",
"countryCode": "IE",
"parentid": 23424803
},
{
"name": "Surabaya",
"woeid": 1044316,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Indonesia",
"url": "http://where.yahooapis.com/v1/place/1044316",
"countryCode": "ID",
"parentid": 23424846
},
{
"name": "Istanbul",
"woeid": 2344116,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Turkey",
"url": "http://where.yahooapis.com/v1/place/2344116",
"countryCode": "TR",
"parentid": 23424969
},
{
"name": "Germany",
"placeType": {
"name": "Country",
"code": 12
},
"woeid": 23424829,
"country": "Germany",
"url": "http://where.yahooapis.com/v1/place/23424829",
"countryCode": "DE",
"parentid": 1
},
{
"name": "Takamatsu",
"woeid": 1118285,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Japan",
"url": "http://where.yahooapis.com/v1/place/1118285",
"countryCode": "JP",
"parentid": 23424856
},
{
"name": "Izmir",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2344117,
"country": "Turkey",
"url": "http://where.yahooapis.com/v1/place/2344117",
"countryCode": "TR",
"parentid": 23424969
},
{
"name": "Nagoya",
"woeid": 1117817,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Japan",
"url": "http://where.yahooapis.com/v1/place/1117817",
"countryCode": "JP",
"parentid": 23424856
},
{
"name": "Philadelphia",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2471217,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2471217",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Hamburg",
"woeid": 656958,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Germany",
"url": "http://where.yahooapis.com/v1/place/656958",
"countryCode": "DE",
"parentid": 23424829
},
{
"name": "Tallahassee",
"placeType": {
"name": "Town",
"code": 7
},
"woeid": 2503713,
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2503713",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Greensboro",
"woeid": 2414469,
"placeType": {
"name": "Town",
"code": 7
},
"country": "United States",
"url": "http://where.yahooapis.com/v1/place/2414469",
"countryCode": "US",
"parentid": 23424977
},
{
"name": "Munich",
"woeid": 676757,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Germany",
"url": "http://where.yahooapis.com/v1/place/676757",
"countryCode": "DE",
"parentid": 23424829
},
{
"name": "Rio de Janeiro",
"woeid": 455825,
"placeType": {
"name": "Town",
"code": 7
},
"country": "Brazil",
"url": "http://where.yahooapis.com/v1/place/455825",
"countryCode": "BR",
"parentid": 23424768
},
{


  "name": "Indianapolis",
    "woeid": 2427032,
    "placeType": {
    "name": "Town",
    "code": 7
    }]';
echo $json;
$decode = json_decode($json, true); //getting the file content as array

 echo "<pre>";
 print_r($decode);
 echo "</pre>";
?>
4

3 に答える 3

1

問題は、入力文字列の最後の行にあります。JSON の形式が正しくありません。

[
  ...
  { // open brace 1
   "name": "Indianapolis",
   "woeid": 2427032,
   "placeType": { // open brace 2
     "name": "Town",
     "code": 7
   } // close brace 2
  } // close brace 1
]';

最後のオブジェクトの右中括弧が省略されました。

于 2012-05-25T19:41:48.380 に答える
1
$obj = json_decode($json, true);
foreach($obj as $item)
{
if ($item["name"] == "United Kingdom")
{
// do something with $item["woeid"]
}
}
于 2012-05-25T19:42:19.067 に答える
1

これを使用してリストを取得できます

$decode = json_decode($json, true); //getting the file content as array
$mynewarray = (array) $decode ;

foreach($mynewarray as $data)
 $data['name'];
于 2012-05-25T19:54:50.077 に答える