I am making a REST request that returns json object RoomGroup. Depending on the parameters in the request it is either returning one Room object or list of Room objects. How to write gson code that can handle both the responses and convert to java correctly?
Ex:
RoomGroup: {
Room: {
numberOfAdults: 2
numberOfChildren: 0
}
}
OR
RoomGroup: {
Room: [2]
0: {
numberOfAdults: 2
numberOfChildren: 0
}
1: {
numberOfAdults: 1
numberOfChildren: 0
}
}