I'm trying to deserialize JSONs of specific structure into Java classes with Jackson. I have several classes like these:
class A {
  private int number1;
  private List<X> list1;
  private int number2;
}
class X {
  private String field1;
  private double value1;
}
class B {
  private String name2;
  private List<Y> list2;
}
class Y {
  private String field2;
}
And I get JSONs from external system like below:
{
  "number1": 1,
  "list1": {
    "elements": [{
      "field1": "Field 1 value 1",
      "value1": 2.2
    }, {
      "field1": "Field 1 value 2"
    }]
  },
  "number2": 2,
}
{
  "name2": "Name 2",
  "list2": {
    "elements": [{
      "field2": "Field 2 value 1"
    }]
  }
}
All I want is to write a custom deserializer, which could get rid of this elements level in a generic way (I mean to have one deserializer for all classes). Is there any simple way to extend a StdDeserializer to accomplish that or a I have to write a whole new deserializer with my custom algorithm?