报错:
Could not write JSON: (was java.lang.NullPointerException); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: entity["key1"]->entity2["key2"])
解决办法:json转换失败,可以去key2的get方法,看看是不是报异常了。例如报空指针