com.fasterxml.jackson.databind.JsonSerializer exclude fields by key

I have a class which I do not have control over it's source:

public class SomeClassImpl implements SomeClass {

private SomeField someFiled; // Not serializable

... // Some other fields that are serializable


So this class is not fully Serializable, and I am running into StackOverflowError when I try to serialize it as json using Spring Boot as @ResponseBody.

I have two controller methods:

@ResponseBody public SomeClassImpl get();

@ResponseBody public SomeOtherClass find();

I have control over the source of SomeOtherClass which includes SomeClass as a property.

I could not figure out how to ignore a field using @JsonIgnore annotation,...

Read More »

By: StackOverFlow - Wednesday, 14 March

Related Posts