嗨,我有这个 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"}]} };
我需要倒数第二个值--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"
}
]
}
}