Could not write JSON: (was java.lang.NullPointerException);

Could not write JSON: (was java.lang.NullPointerException); nested exception is com.fasterxml.jackson.databind.JsonMappingException:
Could not write JSON: (was java.lang.NullPointerException);
java后台没有报错,postman测试时出现了500错误

“Could not write JSON: (was java.lang.NullPointerException); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: com.bjtds.common.utils.Pagination[“content”]->java.util.ArrayList[0]->com.bjtds.statistics.pojo.ReportCurrentTrans[“totalTime”])”,

原因

是因为实体类中字段的get方法用到了其他属性、但是其他属性为空,所以在转换时报错Could not write JSON: (was java.lang.NullPointerException);

解决

将用到的属性赋值即可