Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- "firstname": abc,
- "lastname": xyp,
- "designation" : executive,
- "user": {
- "username": "xypabc",
- "userid": 4003,
- },
- },
- {
- "firstname": pqr,
- "lastname": vbn,
- "designation" : security,
- "user": {
- "username": "vbnpqr",
- "userid": 11231,
- },
- },
- {
- "firstname": ghk,
- "lastname": lkj,
- "designation" : manager,
- "user": {
- "username": "lkjghk",
- "userid": 774,
- },
- }
- ]
- try {
- JSONArray jsonObj = new JSONArray(response);
- for(int i=0 ; i<jsonObj.length(); i++)
- {
- JSONObject json_Data = jsonObj.getJSONObject(i);
- String userName = json_Data.getString("username");
- String userId = json_Data.getString("userid");
- Log.d("Factors","UserName :- "+userName+" ID :- "+userId);
- }
- }catch (JSONException e) {
- Log.d("Failure","Dude I have failed");
- }.
- for(int i=0 ; i<jsonObj.length(); i++)
- {
- JSONObject json_Data = jsonObj.getJSONObject(i);
- String userName = json_Data.getJSONObject("user").getString("username");
- String userId = json_Data.getJSONObject("user").getString("userid");
- Log.d("Factors","UserName :- "+userName+" ID :- "+userId);
- }
- try {
- JSONArray jsonObj = new JSONArray(response);
- for(int i=0 ; i<jsonObj.length(); i++)
- {
- JSONObject json_Data = jsonObj.getJSONObject(i);
- JSONObject user = json_Data.getJSONObject("user");
- String userName = user.getString("username");
- String userId = user.getString("userid");
- Log.d("Factors","UserName :- "+userName+" ID :- "+userId);
- }
- }catch (JSONException e) {
- Log.d("Failure","Dude I have failed");
- }
- JSONArray jresult = new JSONArray(response);
- jresult = json.getJSONArray("user");
- for (int i = 0; i < jresult .length(); i++)
- {
- JSONObject obj = jresult .getJSONObject(i);
- String username=obj.getString("username");
- int userid=obj.getInt("userid");
- }
- if(result != null)
- {
- try
- {
- JSONObject jobj = result.getJSONObject("result");
- String status = jobj.getString("status");
- if(status.equals("true"))
- {
- JSONArray array = jobj.getJSONArray("user");
- for(int x = 0; x < array.length(); x++)
- {
- HashMap<String, String> map = new HashMap<String, String>();
- map.put("username", array.getJSONObject(x).getString("username"));
- map.put("userid", array.getJSONObject(x).getString("userid"));
- list.add(map);
- }
- CalendarAdapter adapter = new CalendarAdapter(Calendar.this, list);
- list_of_calendar.setAdapter(adapter);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- JSONArray jsonObj = new JSONArray(response);
- for(int i=0 ; i<jsonObj.length(); i++)
- {
- JSONObject json_Data = jsonObj.getJSONObject(i);
- String firstname = json_Data.getString("firstname");
- String lastname = json_Data.getString("lastname");
- String designation = json_Data.getString("designation");
- JSONArray jsons1 = json_Data.getJSONArray("user");
- for (int j = 0; j < jsons1.length(); j++) {
- JSONObject jsonss = jsons1.getJSONObject(j);
- String username = jsonss.getString("username");
- String userid = jsonss.getString("userid");
- }
- }
- }catch (JSONException e) {
- Log.d("Failure","Dude I have failed");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement