dream_world dream_world - 1 year ago 102
JSON Question

Jackson Mixin for Class having a List of same Class

I have a class

public class Rectangle
{
int a;
int b;
List<Rectangle> c;
}


I want to use Jackson mixin for this class to modify the Rectangle class using Jackson annotations. Will using below code for List will work?

@JsonProperty("c")
abstract List<Rectangle> getC();


Any help will be appreciated.

Answer Source

As per the suggestion by @Henrik and @zeppelin. I tried out the code and it works fine having a List of same class objects when using Jackson mixin.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download