Map Nested JSON Objects to Java Classes with Spring RestTemplate

前端 未结 7 1348
南旧
南旧 2021-02-08 12:17

I know this may be simple. However, I just can\'t get it to work.

So I am trying to use Spring RestTemplate to map my JSON data. I have following JSON response from a re

相关标签:
7条回答
  • 2021-02-08 13:02

    I had a similar issue when reading Json data from REST API using Rest Template. To resolve declare getters and setters for the List:

    @JsonIgnoreProperties(ignoreUnknown = true)
    public class Response implements Serializable {
    
      private String message;
      private String status;
      private List<Data> data;
    
     // getters and Setters for the list. 
    
    
    }
    

    The RestTemplate will internally map the values from the listarray to the corresponding array.

    0 讨论(0)
提交回复
热议问题