Gson之map解析

需求:

把json字符串解析成map

实现:

Gson gson = new GsonBuilder().enableComplexMapKeySerialization()
		.create();
String param = "xxxxxxx";
Map<String, Map<String, List<MpAppInfo>>> inParams = gson.fromJson(
		param,
		new TypeToken<Map<String, Map<String, List<MpAppInfo>>>>() {
		}.getType());

解决了泛型和key-value序列化

相关推荐