简体   繁体   English

限制所有课程的Jackson序列化/反序列化深度

[英]Limit Jackson Serialization/Deserialization Depth for all the class

I have tried CustomJSONSerializer from Suppress wrapper object when serializing Java object into JSON using Jackson . 当使用Jackson将Java对象序列化为JSON时,我曾尝试从Suppress包装器对象尝试CustomJSONSerializer

But getting following exception: 但是出现以下异常:

com.fasterxml.jackson.databind.JsonMappingException: object is not an instance of declaring class (through reference chain: com.fasterxml.jackson.databind.type.SimpleType["test"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:232)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:197)
at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:183)

I want to serialize entity Like 我想序列化实体

Entity A 实体A

Entity A.Parent 实体A.父母

Entity A.Parent.Parent 实体A.Parent.Parent

I got this error too when switching from jackson 2.1.5 to 2.2.0 (or 2.2.1), try downgrading jackson to 2.1.5? 从杰克逊2.1.5切换到2.2.0(或2.2.1)时,也尝试将杰克逊降级到2.1.5,我也收到了此错误? Assume it's due to stricter checks in 2.2, but haven't figured out yet how to correct it. 假设这是由于在2.2中进行了更严格的检查而引起的,但尚未弄清楚如何纠正它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM