阿里巴巴json fastjson String转javaBean

时间:2023-03-10 01:33:12
阿里巴巴json fastjson String转javaBean
private Entity getEntity(String resp){
        JSONObject jsonObj = (JSONObject) JSON.parse(resp);
        if (jsonObj.getJSONArray("data") != null) {
            jsonObj = jsonObj.getJSONArray("data").getJSONObject(0);
        }
        jsonObj.remove("******");
        Entity entity= JSONObject.toJavaObject(jsonObj,Entity.class);
        return entity;
    }

转好了。