在度娘上搜了好久大多数是用 :
方法1: ObjectMapper mapper = new ObjectMapper();
PageBean<MessageListVO> strPageBean = mapper.readValue(jsonString, PageBean.class); 方法2:(时间格式有问题)
ObjectMapper objectMapper = new ObjectMapper(); Object businsInfo = plaProcessDTO.getBusinessInfo();
EquipmentRepairDto appPlanEquipmepairDto = objectMapper.convertValue(busissInfo, EquipmentRepairDto.class); 这两个都有缺陷
|
正确的转换方式为:
JSONObject jsonObject = (JSONObject) planFloessDTO.getBusssInfo(); EquipmentRepairDto appPlanEqentRepairDto = jsonObject.toJavaObject(EquRepairDto.class);
|
我是个双鱼座的小王子,沉浸在自己的代码世界里,去探索这未知的世界,希望遇到更多的小伙伴一起前行!