Deserialization of google api
https://www.googleapis.com/books/v1/volumes?q=java&maxResults=40
Collection<VolumeInfo> getBooks ()throws IOException {
Resource resource = resourceLoader.getResource("classpath:json/books1.json");
ObjectMapper mapper = new ObjectMapper();
Collection<VolumeInfo> volumeInfo = new ArrayList<VolumeInfo>() {
};
JsonNode rootNode = mapper.readTree(resource.getInputStream());
ArrayNode itemsNode = (ArrayNode) rootNode.get("items");
Iterator<JsonNode> itemsIterator = itemsNode.elements();
while (itemsIterator.hasNext()) {
JsonNode volumeInfoNode = itemsIterator.next();
VolumeInfo volumeInfoObject = mapper.readValue(volumeInfoNode.get("volumeInfo").toString(), VolumeInfo.class);
volumeInfo.add(volumeInfoObject);
}
return volumeInfo;
// JsonNode root = mapper.readValue(resource.getInputStream(), new TypeReference<List<String, Object>>() {});
}