, 아직 내 JSON 요청의 부분 출력은 다음과 같습니다 : 나는 total_distance의 값을 추출하기 위해 표준 JSON 라이브러리를 사용하고자하는 결과 JSON 데이터를 Java로 읽는 방법?
"route_summary": {
"total_distance": 740,
"total_time": 86,
"start_point": "Marienstraße",
"end_point": "Feldbergstraße"
}
. 내가 원하는 것은 '으로'얻을
public static JSONObject readJsonFromUrl(String url) throws IOException, JSONException {
InputStream is = new URL(url).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
JSONObject json = new JSONObject(jsonText);
return json;
} finally {
is.close();
}
}
입니다
JSONObject json = null;
json = readJsonFromUrl(request);
json.get("route_summary");
route_summary, 단서/끝이 좋은 것 : 그러나 나는 단지이 일을하여 'route_summary'를 얻을 수있을 것 같다 !
"in-dept"라고 말합니다. 큰 json 객체의 일부인 json 문자열입니까? –