将JSON数据可视化
开始解析
主要用到两种对象:JSONOBject和JSONArray
下一级array或者object只能通过上一级获取
JSONObject object = new JSONObject(weatherDataString);
JSONArray results = object.getJSONArray("results");
JSONObject location = results.getJSONObject(0).getJSONObject("location");
JSONObject now = results.getJSONObject(0).getJSONObject("now");
String city = location.getString("name");
String weather = now.getString("text");
String weatherCode = now.getString("code");
String temperature = now.getString("temperature");