I'm having a problem while trying to create a model from a json which is formed by json arrays that have same properties but different names.
This is an example of json which i want to transform into a model:
{
"AA": [
{
"t": 1605589200,
"o": 17.37,
"h": 18.3,
"l": 17.11,
"c": 18.28,
"v": 9578592
},
{
"t": 1605675600,
"o": 18.3,
"h": 18.85,
"l": 18.3,
"c": 18.575,
"v": 9092559
}
],
"AAIC": [
{
"t": 1605589200,
"o": 2.92,
"h": 3.045,
"l": 2.92,
"c": 3.02,
"v": 550468
},
{
"t": 1605675600,
"o": 3.11,
"h": 3.1684,
"l": 3.03,
"c": 3.05,
"v": 476259
}
]
}
Notice that each array has the same object structure but have different names ("AA" and "AAIC"). I already wrote the following code:
@Data
public class SomeClass {
private List<SomeClassInfo> someClassInfo;
@Data
public class SomeClassInfo {
@JsonProperty(value = "t")
private Integer time;
@JsonProperty(value = "o")
private Double o;
@JsonProperty(value = "h")
private Double h;
@JsonProperty(value = "l")
private Double l;
@JsonProperty(value = "c")
private Double c;
@JsonProperty(value = "v")
private Integer v;
}
}
But it is not enough, because I don't want to make n lists with specific name such as
@JsonProperty(value = "AA")
List<SomeClassInfo> AA;
@JsonProperty(value = "AAIC")
List<SomeClassInfo> AAIC;
since the example above represents 2 of 10k arrays and each array contains n json object with the same structure.