I have tried CustomJSONSerializer
from
Suppress wrapper object when serializing Java object into JSON using Jackson.
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
Entity A.Parent
Entity A.Parent.Parent