无法为相应的 Json 字符串创建 java 类,因为它的 json 文件太大,并且会动态更改。如果有人可以发布解决方案,我会很高兴。需要帮助....下面是示例代码:..
public class rough {
public static void main(String[] args) throws IOException {
String jsondata="{"data":[{"MsgType":"BTO","EventType":"901","Role":"Sender","Version":"2.3"}, {"MsgType":"BTO","EventType":"901","Role":"Sender","Version":"2.4"},{"MsgType":"BTO","EventType":"901","Role":"Sender","Version":"2.5"},{"MsgType":"BTO","EventType":"901","Role":"Sender","Version":"2.6"},{"MsgType":"BTO","EventType":"901","Role":"Sender","Version":"2.7"}]}";
ObjectMapper objectMapper=new ObjectMapper();
ValidationProfile profile=objectMapper.readValue(jsondata,ValidationProfile.class);
System.out.println("profile:"+profile.toString());
}
public class ValidationProfile {
public List<String> data;
}
}