I have such structure of object:
class A {
List<B> bees;
}
class B {
String с;
}
I'm using Gson parser which serializes such object into this string:
{"a":{"bees":[{"с":"text"}]}}
(with adding a root element "a")
API's format is a little bit different:
{"a":{"bees":[{"b":{"с":"text"}}]}}
I need to be able to parse such strings into A objects correctly.
By default B object (as a part of A) becomes not null, but empty (all fields are null) which is understandable, cause parser doesn't find any field "b" in it (when it is actually a class name).
I'm looking for a general solution for that, I have a lot of such complex objects and I don't want to implement many custom deserializers for each of them.
Gson is not obligatory, I can use another lib if it's necessary.
Thanks.