| @@ -28,11 +28,23 @@ public class WxMenu implements Serializable { | |||||
| public String toJson() { | public String toJson() { | ||||
| return WxGsonBuilder.create().toJson(this); | return WxGsonBuilder.create().toJson(this); | ||||
| } | } | ||||
| /** | |||||
| * 要用 http://mp.weixin.qq.com/wiki/16/ff9b7b85220e1396ffa16794a9d95adc.html 格式来反序列化 | |||||
| * 相比 http://mp.weixin.qq.com/wiki/13/43de8269be54a0a6f64413e4dfa94f39.html 的格式,外层多套了一个menu | |||||
| * @param json | |||||
| * @return | |||||
| */ | |||||
| public static WxMenu fromJson(String json) { | public static WxMenu fromJson(String json) { | ||||
| return WxGsonBuilder.create().fromJson(json, WxMenu.class); | return WxGsonBuilder.create().fromJson(json, WxMenu.class); | ||||
| } | } | ||||
| /** | |||||
| * 要用 http://mp.weixin.qq.com/wiki/16/ff9b7b85220e1396ffa16794a9d95adc.html 格式来反序列化 | |||||
| * 相比 http://mp.weixin.qq.com/wiki/13/43de8269be54a0a6f64413e4dfa94f39.html 的格式,外层多套了一个menu | |||||
| * @param is | |||||
| * @return | |||||
| */ | |||||
| public static WxMenu fromJson(InputStream is) { | public static WxMenu fromJson(InputStream is) { | ||||
| return WxGsonBuilder.create().fromJson(new InputStreamReader(is), WxMenu.class); | return WxGsonBuilder.create().fromJson(new InputStreamReader(is), WxMenu.class); | ||||
| } | } | ||||