比如这么一段json
{
"key":"client_bind",
"data":{
"channel":"browser",
"version":"1.0.0",
"osVersion":"1.0.0",
"packageName":"com.aaa.webapp",
"deviceId":"u",
"device":"Chrome"
}
}
对应的java对象是
public class Body {
private String key;
private HashMap<String, String> data = new HashMap<String, String>();
}
通过Body body = JSON.parseObject(json, Body.class);解析后 data是空的
3条答案
按热度按时间dfddblmv1#
你的 定义 channel version osVersion ... 这些属性吧
private entity data = new entity();
b0zn9rqh2#
@Funset
加上get/set方法就可以了
kx7yvsdv3#
三种解决办法:
修改为