I am doing my first steps with JSON programming. I have big json file with books archive from:
https://www.googleapis.com/books/v1/volumes?q=java&maxResults=30
I created POJO's with getters and setters. Now I want to find for example all books wrote by given author:
byte[] jsonData = Files.readAllBytes(Paths.get("archive.json"));
ObjectMapper objectMapper = new ObjectMapper();
JsonNode rootNode = objectMapper.readTree(jsonData);
JsonNode authorNode = rootNode.path("Gary Cornell");
Iterator<JsonNode> elements = authorNode.elements();
while(elements.hasNext()){
JsonNode isbn = elements.next();
System.out.println(isbn.textValue());
}
But saddly I am doing something wrong. My app just write whole json.