こんにちは、私はこのjsonデータを持っています
var json = { "@@lang": "en-US", "ResultSet": { "@@version": "2.0", "@@lang": "en-US", "Error": "0", "ErrorMessage": "No error", "Locale": "en-US", "Found": "1", "Quality": "99", "Results": [{ "quality": "72", "latitude": "30.778864", "longitude": "76.686648", "offsetlat": "30.778864", "offsetlon": "76.686648", "radius": "400", "name": "30.78,76.69", "line1": "30.78,76.69", "line2": "", "line3": "Mohali, Sahibzadaajit Singh Nagar, Punjab", "line4": "India", "house": "", "street": "", "xstreet": "", "unittype": "", "unit": "", "postal": "", "neighborhood": "", "city": "Mohali", "county": "Sahibzadaajit Singh Nagar", "state": "Punjab", "country": "India", "countrycode": "IN", "statecode": "PB", "countycode": "", "uzip": "", "hash": "", "woeid": "2290786", "woetype": "7"}]} };
最後から 2 番目の値が必要です --woeid:2209786
jsonを使用してこの値を取得するにはどうすればよいですか?
更新 / 編集 (フォーマットされた JSON)
{
"@@lang": "en-US",
"ResultSet": {
"@@version": "2.0",
"@@lang": "en-US",
"Error": "0",
"ErrorMessage": "No error",
"Locale": "en-US",
"Found": "1",
"Quality": "99",
"Results": [
{
"quality": "72",
"latitude": "30.778864",
"longitude": "76.686648",
"offsetlat": "30.778864",
"offsetlon": "76.686648",
"radius": "400",
"name": "30.78,76.69",
"line1": "30.78,76.69",
"line2": "",
"line3": "Mohali, Sahibzadaajit Singh Nagar, Punjab",
"line4": "India",
"house": "",
"street": "",
"xstreet": "",
"unittype": "",
"unit": "",
"postal": "",
"neighborhood": "",
"city": "Mohali",
"county": "Sahibzadaajit Singh Nagar",
"state": "Punjab",
"country": "India",
"countrycode": "IN",
"statecode": "PB",
"countycode": "",
"uzip": "",
"hash": "",
"woeid": "2290786",
"woetype": "7"
}
]
}
}