我创建了反序列化的样例类和响应,但这是需要修复的同一个问题.响应可以是带对象的数组,也可以是just an Object
.
需要动态反序列化
班级
public record Main班级(
//the response can either be array or not array
@JsonProperty("Relation") List<Relation> relation
){
}
public record Relation(
String relation,
String Id,
){
}
如果响应为数组Working
,则反序列化
响应
{
"Relation": [
{
"url": "https://sample.com",
"Id": "77"
}
]
}
当If响应不是数组时反序列化
This need to be fix
个
响应
{
"Relation":{
"url": "https://sample.com",
"Id": "77"
}
}