Please give me an idea of how to build the structure of Java objects for deserialization of this Json. I ask you not to offer generators from the Internet (they cannot generate correct objects due to the Json structure).
"objects" : {
"Incident::123456" : {
"code" : 0,
"message" : "",
"class" : "Inc",
"key" : "1036022",
"fields" : {
"id" : "1654321",
"title" : "title"
}
},
"Incident::1046077" : {
"code" : 0,
"message" : "",
"class" : "Inc",
"key" : "1046077",
"fields" : {
"id" : "1654322",
"title" : "title"
}
}
},
"code" : 0,
"message" : "Found: 2"
}
The objects that come (like “”Incident::”) have different values, their number can be infinitely large.
For each POJO, the fields of interest are in “fields” : {}
At first glance, the problem seems trivial to me, but I have not yet been able to solve it.
Is there a sane solution for such a structure? Could it be the right decision to create custom functionality?
As a result, I need to get a list of objects like:
public class Test {
private int id; \ from "fields" : {"id" : "1654322"}
private String title; \ from "fields" : {"title" : "title"}
}
Thank you.