@Test public void testFromJson() { String json = "{\n" + " \"stepInfoList\": [\n" + " {\n" + " \"timestamp\": 1445866601,\n" + " \"step\": 100\n" + " },\n" + " {\n" + " \"timestamp\": 1445876601,\n" + " \"step\": 120\n" + " }\n" + " ]\n" + "}"; final List<WxMaRunStepInfo> stepInfoList = WxMaRunStepInfo.fromJson(json); assertThat(stepInfoList).isNotEmpty(); assertThat(stepInfoList.get(0).getStep()).isEqualTo(100); assertThat(stepInfoList.get(0).getTimestamp()).isEqualTo(1445866601); assertThat(stepInfoList.get(1).getStep()).isEqualTo(120); assertThat(stepInfoList.get(1).getTimestamp()).isEqualTo(1445876601); }
public static List<WxMaRunStepInfo> fromJson(String json) { JsonObject jsonObject = JSON_PARSER.parse(json).getAsJsonObject(); return WxMaGsonBuilder.create().fromJson(jsonObject.get("stepInfoList").toString(), new TypeToken<List<WxMaRunStepInfo>>() { }.getType()); }
WxMaRunStepInfo implements Serializable { public static List<WxMaRunStepInfo> fromJson(String json) { JsonObject jsonObject = JSON_PARSER.parse(json).getAsJsonObject(); return WxMaGsonBuilder.create().fromJson(jsonObject.get("stepInfoList").toString(), new TypeToken<List<WxMaRunStepInfo>>() { }.getType()); } }
WxMaRunStepInfo implements Serializable { public static List<WxMaRunStepInfo> fromJson(String json) { JsonObject jsonObject = JSON_PARSER.parse(json).getAsJsonObject(); return WxMaGsonBuilder.create().fromJson(jsonObject.get("stepInfoList").toString(), new TypeToken<List<WxMaRunStepInfo>>() { }.getType()); }  }
WxMaRunStepInfo implements Serializable { public static List<WxMaRunStepInfo> fromJson(String json) { JsonObject jsonObject = JSON_PARSER.parse(json).getAsJsonObject(); return WxMaGsonBuilder.create().fromJson(jsonObject.get("stepInfoList").toString(), new TypeToken<List<WxMaRunStepInfo>>() { }.getType()); }  static List<WxMaRunStepInfo> fromJson(String json); }
WxMaRunStepInfo implements Serializable { public static List<WxMaRunStepInfo> fromJson(String json) { JsonObject jsonObject = JSON_PARSER.parse(json).getAsJsonObject(); return WxMaGsonBuilder.create().fromJson(jsonObject.get("stepInfoList").toString(), new TypeToken<List<WxMaRunStepInfo>>() { }.getType()); }  static List<WxMaRunStepInfo> fromJson(String json);  }