아래에 언급 된 JSON을 구문 분석하고 screenshot.thumbnailUrl의 모든 값을 가져오고 싶습니다. 하지만 내 제약 조건은 다음과 같습니다.키를 모르는 상태에서 json을 읽으십시오. #
일부 노드에는 스크린 샷이 없습니다. 이 예제에서는 "날씨"와 "엔터티"만이 있습니다.
노드 이름을 모르겠습니다. 이 예제에서는 "weather"또는 "entities"라는 노드가 있다는 것을 알지 못했습니다. 이 노드는 json을 얻기 위해 만든 쿼리를 기반으로 자동 생성됩니다.
스크린 샷을 표시 할 수있는 장소는 두 곳입니다. (1) 루트 객체의 하위 예. weather.screenshot (2) 루트 객체의 모든 자식 값 (예 : entities.value [0] .screenshot, entities.value [1] .screenshot 등
{ "_type": "SearchResponse", "queryContext": {}, "webPages": {}, "entities": {
"queryScenario": "DominantEntity",
"value": [
{
"_type": "Place",
"id": "https://www.someapi.com/api/v6/#Entities.0",
"screenshot": {
"thumbnailUrl": "http://Screenshot_URL_I_Want",
"width": 285
},
"name": "Seattle",
"entityPresentationInfo": {},
"bingId": "5fbba6b8-85e1-4d41-9444-d9055436e473",
"boundingBox": [],
"weather": {},
"timeZone": "Pacific Standard Time"
}
] }, "images": {}, "weather": {
"id": "https://www.someapi.com/api/v6/#Weather",
"screenshot": {
"thumbnailUrl": "http://Screenshot_URL_I_Want",
"width": 285
},
"location": {},
"currentWeather": {},
"dailyForecast": [] }, "rankingResponse": {} }
당신은 역 직렬화를 사용할 수 있습니까? – StellaMaris