I have a response from a URL that looks like this:
{"seq":1,"id":"Test1","changes":[{"rev":"1-52f5cdf008ecfbadf621c2939af7bd80"}]} {"seq":2,"id":"Test2","changes":[{"rev":"1-8ce403a89dc5e7cb4187a16941b3fb7d"}]} {"seq":3,"id":"Test3","changes":[{"rev":"1-52as7ddfd8ecfbadf621c2939af7bd80"}]} {"seq":4,"id":"Test4","changes":[{"rev":"1-6yy03a89dc5e7cb45677a16941b3fb7d"}]}
If the display object is String, then it receives all change feeds.
ResponseEntity<String> responseEntity = restTemplate.exchange(URL, HttpMethod.GET, requestEntity, String.class);
Whereas if I use a custom Value object, for example:
public class KnChanges { private long seq; private String id; private List changes;
with getter and setter methods, then I get only the first data about the document change. Even if KnChanges [] (array) is used, only the first change is obtained.
Could you please help how the JSON list structure mentioned above can be mapped to an object?
Thanks Harsha
source share