如果我在Response中得到不同的根元素,如何将响应反序列化到Pojo类中

时间:2019-08-09 12:01:49

标签: json-deserialization

I'm getting response from server with different root element. I'm new to API automation so i don't have any idea how to map those responses to corresponding POJO classes.


I don't have clue how to do that.

Example Response :

Response 1:
{
  "A": {
    "vehicle_id": "1",
    "route_id": "1",
    "route_name": "ABC",
    "stop_name": "Hyd1",
    "vehicle": "X"
  }
}

响应2:     {       “ B”:{         “ vehicle_id”:“ 2”,         “ route_id”:“ 2”,         “ route_name”:“ ABD”,         “ stop_name”:“ Hyd2”,         “车辆”:“ Y”       }     }     回应3:     {       “C”: {         “ vehicle_id”:“ 3”,         “ route_id”:“ 3”,         “ route_name”:“ ABEDC”,         “ stop_name”:“ Hyd3”,         “车辆”:“ Z”       }     }

0 个答案:

没有答案