@Test public void testFromJson() throws Exception { String json = "{ \n" + " \"is_add_friend_reply_open\": 1, \n" + " \"is_autoreply_open\": 1, \n" + " \"add_friend_autoreply_info\": { \n" + " \"type\": \"text\", \n" + " \"content\": \"Thanks for your attention!\"\n" + " }, \n" + " \"message_default_autoreply_info\": { \n" + " \"type\": \"text\", \n" + " \"content\": \"Hello, this is autoreply!\"\n" + " }, \n" + " \"keyword_autoreply_info\": { \n" + " \"list\": [ \n" + " { \n" + " \"rule_name\": \"autoreply-news\", \n" + " \"create_time\": 1423028166, \n" + " \"reply_mode\": \"reply_all\", \n" + " \"keyword_list_info\": [ \n" + " { \n" + " \"type\": \"text\", \n" + " \"match_mode\": \"contain\", \n" + " \"content\": \"news测试\" " }\n" + " ], \n" + " \"reply_list_info\": [ \n" + " { \n" + " \"type\": \"news\", \n" + " \"news_info\": { \n" + " \"list\": [ \n" + " { \n" + " \"title\": \"it's news\", \n" + " \"author\": \"jim\", \n" + " \"digest\": \"it's digest\", \n" + " \"show_cover\": 1, \"cover_url\": \"http: " euPKmFLK0ZQ/0\", \n" + " \"content_url\": \"http: " \"source_url\": \"http: " }\n" + " ]\n" + " }\n" + " }, \n" + " { \n" + " \"type\": \"news\",\n" + " \"content\":\"KQb_w_Tiz-nSdVLoTV35Psmty8hGBulGhEdbb9SKs-o\", \n" + " \"news_info\": { \n" + " \"list\": [ \n" + " { \n" + " \"title\": \"MULTI_NEWS\", \n" + " \"author\": \"JIMZHENG\", \n" + " \"digest\": \"text\", \n" + " \"show_cover\": 0, \n" + " \"cover_url\": \"http: "hTcm9sDA/0\", \n" + " \"content_url\": \"http: " \"source_url\": \"\"\n" + " },\n" + " { \n" + " \"title\": \"MULTI_NEWS4\", \n" + " \"author\": \"JIMZHENG\", \n" + " \"digest\": \"MULTI_NEWSMULTI_NEWSMULTI_NEWSMULTI_NEWSMULTI_NEWSMULT\", \n" + " \"show_cover\": 1, \n" + "\"cover_url\": \"http: "HeuPKmFLK0ZQ/0\", \n" + " \"content_url\": \"http: " \"source_url\": \"\"\n" + " }\n" + " ]\n" + " }\n" + " }\n" + " ]\n" + " }, \n" + " { \n" + " \"rule_name\": \"autoreply-voice\", \n" + " \"create_time\": 1423027971, \n" + " \"reply_mode\": \"random_one\", \n" + " \"keyword_list_info\": [ \n" + " { \n" + " \"type\": \"text\", \n" + " \"match_mode\": \"contain\", \n" + " \"content\": \"voice测试\"\n" + " }\n" + " ], \n" + " \"reply_list_info\": [ \n" + " { \n" + " \"type\": \"voice\", \n" + " \"content\": \"NESsxgHEvAcg3egJTtYj4uG1PTL6iPhratdWKDLAXYErhN6oEEfMdVyblWtBY5vp\"\n" + " }\n" + " ]\n" + " }, \n" + " { \n" + " \"rule_name\": \"autoreply-text\", \n" + " \"create_time\": 1423027926, \n" + " \"reply_mode\": \"random_one\", \n" + " \"keyword_list_info\": [ \n" + " { \n" + " \"type\": \"text\", \n" + " \"match_mode\": \"contain\", \n" + " \"content\": \"text测试\"\n" + " }\n" + " ], \n" + " \"reply_list_info\": [ \n" + " { \n" + " \"type\": \"text\", \n" + " \"content\": \"hello!text!\"\n" + " }\n" + " ]\n" + " }, \n" + " { \n" + " \"rule_name\": \"autoreply-video\", \n" + " \"create_time\": 1423027801, \n" + " \"reply_mode\": \"random_one\", \n" + " \"keyword_list_info\": [ \n" + " { \n" + " \"type\": \"text\", \n" + " \"match_mode\": \"equal\", \n" + " \"content\": \"video测试\"\n" + " }\n" + " ], \n" + " \"reply_list_info\": [ \n" + " { \n" + " \"type\": \"video\", \n" + "\"content\": \"http: " }\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + "}"; WxMpCurrentAutoReplyInfo autoReplyInfo = WxMpCurrentAutoReplyInfo.fromJson(json); assertNotNull(autoReplyInfo); assertTrue(autoReplyInfo.getIsAddFriendReplyOpen()); assertTrue(autoReplyInfo.getIsAutoReplyOpen()); assertNotNull(autoReplyInfo.getAddFriendAutoReplyInfo()); assertNotNull(autoReplyInfo.getMessageDefaultAutoReplyInfo()); assertTrue(autoReplyInfo.getKeywordAutoReplyInfo().getList().size() > 0); System.out.println(autoReplyInfo); }
public static WxMpCurrentAutoReplyInfo fromJson(String json) { return WxMpGsonBuilder.create().fromJson(json, WxMpCurrentAutoReplyInfo.class); }
WxMpCurrentAutoReplyInfo implements Serializable { public static WxMpCurrentAutoReplyInfo fromJson(String json) { return WxMpGsonBuilder.create().fromJson(json, WxMpCurrentAutoReplyInfo.class); } }
WxMpCurrentAutoReplyInfo implements Serializable { public static WxMpCurrentAutoReplyInfo fromJson(String json) { return WxMpGsonBuilder.create().fromJson(json, WxMpCurrentAutoReplyInfo.class); }  }
WxMpCurrentAutoReplyInfo implements Serializable { public static WxMpCurrentAutoReplyInfo fromJson(String json) { return WxMpGsonBuilder.create().fromJson(json, WxMpCurrentAutoReplyInfo.class); }  @Override String toString(); static WxMpCurrentAutoReplyInfo fromJson(String json); }
WxMpCurrentAutoReplyInfo implements Serializable { public static WxMpCurrentAutoReplyInfo fromJson(String json) { return WxMpGsonBuilder.create().fromJson(json, WxMpCurrentAutoReplyInfo.class); }  @Override String toString(); static WxMpCurrentAutoReplyInfo fromJson(String json);  }