JSON转为Java实体类

//用这jar包
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;


//两行解决
JSONObject jsonObject = JSONObject.parseObject(responseEntity.getBody());
Weather weather = JSON.parseObject(String.valueOf(jsonObject), Weather.class);

就这就这? 就这

``

posted @ 2021-11-06 18:42  dnydys  阅读(457)  评论(0)    收藏  举报