I am retrieving JSON data and store it in array for using.
I get the json data by:-
Uri uri = new Uri.Builder().scheme("http").authority().path().build();
System.out.println("uri of category is : -"+uri);
URI u = new URI(uri.toString());
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(u);
HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
is = entity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(is),8);
sb = new StringBuilder();
sb.append(reader.readLine() + "\n");
String line="0";
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
result=sb.toString();
but my json is some other type. so i am confuse how to get and store in my arraylist.
{
employee: [
{
name: "ajay",
id: 1,
},
{
name: "rajiv",
id: 2,
}
],
address: [
{
city: "bombay",
pin: 114141
}
]
}
I know that there is first JSONObject and having two jsonarray. but how can i retrive it.