Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. [{"body":"{"id":"act_105099966308460","account_id":105099966308460,"name":"","account_status":2,"currency":"USD","timezone_id":1,"timezone_name":"America\/Los_Angeles","timezone_offset_hours_utc":-7,"is_personal":0,"business_name":"","business_street":"44916
  2. Winding
  3. Lane","business_street2":"","business_city":"Fremont","business_state":"CA","business_zip":"94539","business_country_code":"US","vat_status":0,"daily_spend_limit":25000,"users":[{"uid":100004253709632,"permissions":[1,2,3,4,5,7],"role":1001}],"notification_settings":{"100004253709632":{"1000":{"1":1},"1001":{"1":1},"1002":{"1":1,"2":60},"1003":{"1":1,"2":60},"1004":{"1":1},"1005":{"1":1},"1006":{"1":1},"1009":{"1":1},"1010":{"1":1},"1011":{"1":1},"2000":{"1":1,"2":60},"2001":{"1":1,"2":60},"2002":{"2":60},"2003":{"1":1,"2":60},"2004":{"1":1,"2":60},"2005":{"1":1,"2":60},"3000":{"1":1,"2":60},"3001":{"1":1,"2":60},"3002":{"2":60},"3003":{"2":60},"5000":{"1":1},"6000":{"1":1},"6001":{"1":1},"9000":{"1":1,"2":60},"8000":{"1":1,"2":60}}},"account_groups":[{"account_group_id":344615332296926,"name":"my
  4. test
  5. group","status":1},{"account_group_id":218621204934411,"name":"inmobi
  6. Ads
  7. group","status":1},{"account_group_id":267052626739836,"name":"Test
  8. ad account
  9. group1","status":1}],"capabilities":[2],"balance":0,"moo_default_conversion_bid":1000,"amount_spent":0}"}]
  10.  
  11. Type listType = new TypeToken<List<BatchAccounts>>(){}.getType();
  12.  
  13. Gson gson = new Gson();
  14.  
  15. List<BatchAccounts> results = gson.fromJson(response1, listType);
  16.  
  17. public class BatchAccounts
  18. {
  19. private Account body;
  20.  
  21. public Account getBody()
  22. {
  23. return body;
  24. }
  25.  
  26. }
  27.  
  28.  
  29. public class Account
  30. {
  31.  
  32. private String id;
  33.  
  34. private String account_id;
  35.  
  36. public String getId()
  37. {
  38. return id;
  39. }
  40.  
  41. public String getAccount_id()
  42. {
  43. return account_id;
  44. }
  45.  
  46. }
  47.  
  48. Gson gson = new Gson();
  49.  
  50. List<BodyHolder> bodies = gson.fromJson(response1,
  51. new TypeToken<List<BodyHolder>>() {}.getType());
  52.  
  53. List<BatchAccounts> result = new ArrayList<BatchAccounts>(bodies.size());
  54. for (BodyHolder holder: bodies) {
  55. BatchAccounts a = new BatchAccounts();
  56. a.setBody(gson.fromJson(holder.getBody(), Account.class);
  57. result.add(a);
  58. }
  59.  
  60. public class BodyHolder
  61. {
  62. private String body;
  63. ...
  64. }
  65.  
  66. Gson gson = new Gson();
  67.  
  68. List<BodyHolder> bodies = gson.fromJson(response1,
  69. new TypeToken<List<BodyHolder>>() {}.getType());
  70.  
  71. List<BatchAccounts> result = new ArrayList<BatchAccounts>(bodies.size());
  72. for (BodyHolder holder: bodies) {
  73. BatchAccounts a = new BatchAccounts();
  74. a.setBody(gson.fromJson(holder.getBody(), Account.class);
  75. result.add(a);
  76. }
  77.  
  78. public class BodyHolder
  79. {
  80. private String body;
  81. ...
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement