We are going to practice deserializing a JSON collection with Jackson
We are going to add to the previous exercise.
Instead of deserializing one book, we are going to derserialize a collection of books.
Write a program that reads in a JSON file representing a collection book and then prints the information of the file to stdout:
The JSON file:
[
{
"title": "To Kill a Mockingbird",
"author": "Harper Lee",
"year": 1960
},
{
"title": "1984",
"author": "George Orwell",
"year": 1949
},
{
"title": "Pride and Prejudice",
"author": "Jane Austen",
"year": 1813
}
]
The output of the program would look something like this
Title: To Kill a Mockingbird
Author: Harper Lee
Year: 1960
----------------------
Title: 1984
Author: George Orwell
Year: 1949
----------------------
Title: Pride and Prejudice
Author: Jane Austen
Year: 1813
----------------------
Calculate the average age of the books in the list and also print this to stdout.