In my service I am:
- Getting a JSON object from a remote server
- Partially parse this object to do my logic
- Return the full object to a remote caller
The object is quite complex and I only need very few fields from it.
I would like to create an incomplete domain class that exposes the fields I'm interested for my logic but that keeps track of all object tree once it is serialized again as answer to the caller.
Is there any generic object in GSON library that fulfill my needs?
Example of JSON:
{
"id": 1,
"payload": { /* complex object here */ }
}
I only need the id and would like to model only this field. Example:
public class MyDomain {
int id;
JSonGenericObject payload;
}
Still I need the payload reference because at the end the full object must be transmitted to the remote caller which started the procedure