我有q要求我收到JSON输入并显示它。每当我点击JSON的任何值时,我都需要按顺序获取所有父键。
以下是示例JSON
{
"response": {
"Location": [{
"Name": "New York, NY",
"Point": {
"Latitude": "40.714550018310547",
"Longitude": "-74.007118225097656"
},
"BoundingBox": {
"SouthLatitude": "40.36376953125",
"WestLongitude": "-74.745925903320312",
"NorthLatitude": "41.056510925292969",
"EastLongitude": "-73.267219543457031"
},
"EntityType": "PopulatedPlace",
"Address": {
"AdminDistrict": "NY",
"CountryRegion": "United States",
"FormattedAddress": "New York, NY",
"Locality": "New York"
},
"Confidence": "High",
"MatchCode": "Good",
"GeocodePoint": {
"Latitude": "40.714550018310547",
"Longitude": "-74.007118225097656",
"CalculationMethod": "Rooftop",
"UsageType": "Display"
}
}, {
"Name": "New York, NY",
"Point": {
"Latitude": "40.714550018310547",
"Longitude": "-74.007118225097656"
},
"BoundingBox": {
"SouthLatitude": "40.36376953125",
"WestLongitude": "-74.745925903320312",
"NorthLatitude": "41.056510925292969",
"EastLongitude": "-73.267219543457031"
},
"EntityType": "PopulatedPlace",
"Address": {
"AdminDistrict": "NY",
"CountryRegion": "United States",
"FormattedAddress": "New York, NY",
"Locality": "New York"
},
"Confidence": "High",
"MatchCode": "Good",
"GeocodePoint": {
"Latitude": "40.714550018310547",
"Longitude": "-74.007118225097656",
"CalculationMethod": "Rooftop",
"UsageType": "Display"
}
}]
}
}
现在,我在json response → Location → Point → Latitude
中拥有这个密钥链。假设我有一个键Latitude
并且我想要一个序列中的所有父键,我该怎么做?
注意:这是一个示例JSON。请记住,我将动态获取JSON。