Как мне проанализировать следующий json "OpenWeathermap"Android

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Как мне проанализировать следующий json "OpenWeathermap"

Сообщение Anonymous »

Я использую www.openweathermap.org. Это является результатом прогноза: http://api.openweathermap.org/data/2.5/ ... 35&lon=139

Код: Выделить всё

JSONObject coordObj = getObject("coord", jObj);
Latitude = getFloat("lat", coordObj);
Longitude = getFloat("lon", coordObj);
JSONObject coordObj = getObject("city", jObj);
id = getFloat("id", coordObj);
name = getFString("name", coordObj);
JSONObject sysObj = getObject("sys", jObj);
Country = getString("country", sysObj);
Sunrise = getInt("sunrise", sysObj));
Sunset = getInt("sunset", sysObj));
JSONObject jlist = jObj.getObject("list");

JSONObject JSONWeather = jArr.getJSONObject(0);
Condition_id == getInt("id", JSONWeather);
condition_description = getString("description", JSONWeather);
condition = getString("main", JSONWeather);
condition_icongetString("icon", JSONWeather);

JSONObject mainObj = getObject("main", jObj);
Humidity = getInt("humidity", mainObj);
Pressure = getInt("pressure", mainObj);
MaxTemp = getFloat("temp_max", mainObj);
MinTemp(getFloat("temp_min", mainObj);

Temp = getFloat("temp", mainObj);

// Wind
JSONObject wObj = getObject("wind", jObj; Speed = getFloat("speed", wObj); Deg = getFloat("deg", wObj);

// Clouds
JSONObject cObj = getObject("clouds", jObj); Perc = getInt("all", cObj);
Как cam a lip погодный массив?


Подробнее здесь: https://stackoverflow.com/questions/169 ... weathermap
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»