Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. while(cursor.hasNext()) {
  2. System.out.println(cursor.next());
  3.  
  4. JSONObject temp_user = new JSONObject();
  5. temp_user.put("username", cursor.curr().get("username"));
  6. temp_user.put("verified", cursor.curr().get("verified"));
  7. temp_user.put("first_name", cursor.curr().get("first_name"));
  8. temp_user.put("surname", cursor.curr().get("surname"));
  9.  
  10. this.username = (String)cursor.curr().get("username");
  11. String user_info = this.get_user();
  12. JSONParser parser = new org.json.simple.parser.JSONParser();
  13. System.out.println(user_info);
  14. JSONObject user_obj = (JSONObject) parser.parse(user_info);
  15. if (user_obj.get("Location") instanceof JSONObject) {
  16. JSONObject Loc = (JSONObject)user_obj.get("Location");
  17. temp_user.put("Location",Loc.get("__text"));
  18. }
  19. else{
  20. temp_user.put("Location",user_obj.get("Location"));
  21. }
  22. // temp_user.put("Location", cursor.curr().get("Location"));
  23. temp_user.put("Country", cursor.curr().get("Country"));
  24. array.add(temp_user);
  25. count++;
  26. if (count == n) { break; }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement