1、toJSONString
String str = JSON.toJSONString(Entity);
2、parseObject
Entity toObj = JSON.parseObject(str, Entity.class);
3、parseArray
String arrJson = JSON.toJSONString(entityList);
List<Entity> arrList = JSON.parseArray(arrJson, Entity.class);
4、toJavaList —> str转list
JSONArray ja = JSONArray.parseArray(str);
List<PrescoVehicle> pvList= ja.toJavaList(PrescoVehicle.class);```
5、list实体转string json格式
// 初始化ObjectMapper对象
ObjectMapper objectMapper = new ObjectMapper();
String jsonString = objectMapper.writeValueAsString(qjysList);
6、string json格式转JsonArray
JSONArray jsonArray= JSONArray.parseArray(data);