Basically i am trying to make an weather app. And i tried to retrieved some data (lets say lat and lon from crood object) but whenever i run the application it doesn't show me any error but it show in logcat an exception which says "No value for crood". I have tried every resource that i had but i am unable to display data to textviews.
this is the json i want want to target
{"coord":{"lon":-0.13,"lat":51.51},"weather": [{"id":721,"main":"Haze","description":"haze","icon":"50d"}, {"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}, {"id":311,"main":"Drizzle","description":"rain and drizzle","icon":"09d"}],"base":"stations","main":{"temp":286.15,"pressure":1013,"humidity":87,"temp_min":286.15,"temp_max":286.15},"visibility":10000,"wind":{"speed":3.1,"deg":200},"clouds":{"all":75},"dt":1445700000,"sys": {"type":1,"id":5089,"message":0.0153,"country":"GB","sunrise":1445668823,"sunset":1445705286},"id":2643743,"name":"London","cod":200}
This is how i am doing it
String finalJson=buffer.toString();
JSONObject parentObject = new JSONObject(finalJson);
JSONObject jsonObject =parentObject.getJSONObject("crood");
If somebody help me with this logic how to parse it. I want to get lat,lon,name,description,temp and pressure out of this data and i want to show it in textviews.