Search code examples
jacksongsonpojo

Design solution for many Pojo classes when using Jackson/gson


I'm creating an android application with a server back end. For sending json data between the two tiers I am using Gson(Android) and Jackson(Spring server).

I find myself creating a lot of simple Pojo classes for the serialization from and to json data.

If I have 30 api calls, with different information in it, I will have to create 30 simple Pojo Classes. Actually 60 because they have to exist both on the server and client.

Is there anyway around this 'problem'?


Solution

  • Check below link Use @JsonAnyGetter And @JsonAnySetter annotation.

    Mapping JSON with varying object name