I have json objects in the following schema:
{
name: "foo",
timestamp: 1475840608763,
payload:
{
foo: "bar"
}
}
Here, the payload
field contains an embedded json object, and the schema of this object is dynamic, and different each time.
The payload
object is the raw output obtained from different API services, and different methods of different API services. It isn't possible to map it to all possible values.
Is it possible to have a java class such as the following:
public class Event
{
public String name;
public long timestamp;
public JsonObject payload;
}
Or something along those lines, so I can receive the basic schema and process it, then send it to the relevant class which will convert payload
to its appropriate expected class?