{
"code": 200,
"status": "OK",
"developerMessage": "OK",
"userMessage": "Operation Successful",
"data": {
"settings": {
"countries": {
"1": "Afghanistan",
"2": "Albania",
"3": "Algeria",
"4": "Andorra",
"5": "Angola",
},
"mobile-code": {
"+93": "Afghanistan +93",
"+355": "Albania +355",
"+213": "Algeria +213",
"+376": "Andorra +376",
"+244": "Angola +244",
}
},
"status_code": 200,
"success": true,
},
"dataType": "map"
}
答案 0 :(得分:0)
这些是数组,但表示为键值。
您可以考虑Map<String, Object>
然后:
ObjectMapper mapper = new ObjectMapper();
TypeReference<HashMap<String, Object>> typeReference =
new TypeReference<HashMap<String, Object>>() {};
Map<String, Object> data = mapper.readValue(json, typeReference);
答案 1 :(得分:0)
我得到了这样的话:
@JsonIgnoreProperties(ignoreUnknown = true)
public class Settings {
@SerializedName("countries")
Map<String, String> countries;
public Map<String, String> getCountries() {
return countries;
}
public void setCountries(Map<String, String> countries) {
this.countries = countries;
}
}