[{"post":{"titel":"Glee","interpret":"Bran Van 3000","jahr":"1997","id":"5"}},{"post":{"titel":"Goodbye Country (Hello Nightclub)","interpret":"Groove Armada","jahr":"2001","id":"4"}},{"post":{"titel":"Beauty","interpret":"Ryuichi Sakamoto","jahr":"1990","id":"1"}}]
上面的字符串是我在 json 中所拥有的,现在我想要做的是像上面的字符串一样获取“post”和“titel”的值,我有 3 个 post 值,这对我来说是有意义的。但是,现在我想要打印 post 的所有 3 个值和 post 字符串中的每个值。
JSONArray jsonArray = new JSONArray(jsonString);
columns = new String[jsonArray.length()];
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
columns[i]=jsonObject.getString("post");
}
上面的代码返回我 3 个帖子值。如果我想打印帖子的值和帖子中列的每个值,我该怎么办?