我有这个方法:
public static Response deserializeResponse(String jsonResponse) throws JsonParseException, JsonMappingException, IOException {
ObjectMapper mapper = new ObjectMapper();
try{
return mapper.readValue(jsonResponse, Response.class);
}catch(JsonParseException e){
e.printStackTrace();
}catch(JsonMappingException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
这是类Response:
public static class Response {
public String RequestType;
public Data data;
public void SetRequestType(String requestType) { this.RequestType = requestType; }
@JsonIgnore
@JsonProperty("data")
public void SetData(Data data) { this.data = data; }
public Response(){
data = new Data();
}
public static class Data {
public String Status; …Run Code Online (Sandbox Code Playgroud)