這是我從URL返回的JSON字符串,我想從下面的JSON字符串中提取highDepth
值。如何從JSON中嵌入的JSON中提取屬性?
{
"description": "",
"bean": "com.hello.world",
"stats": {
"highDepth": 0,
"lowDepth": 0
}
}
我在這裏使用GSON,因爲我是GSON的新手。如何使用GSON從上述JSON Strirng中提取highDepth
?
String jsonResponse = restTemplate.getForObject(url, String.class);
// parse jsonResponse to extract highDepth
這是一個可能重複: http://stackoverflow.com/questions/8233542/parse-a-nested -json - 使用 - GSON http://stackoverflow.com/questions/19169754/parsing-nested-json-data-using-gson http://stackoverflow.com/questions/4453006/java-gson-parsing-nested-within-nested – Zoneh