We are going to practice deserializing a rather complex JSON collection with Jackson.
Create a new package and make sure the Jackson library is available for the project.
Note: You may need to read the Annotation part from the theory before attempting this assignment.
Write a program that reads in a JSON file the weather for a city in a particular week:
The JSON file:
[
{
"location": "San Francisco",
"forecast": [
{
"day": "Monday",
"temperature": 20.5,
"condition": "Sunny"
},
{
"day": "Tuesday",
"temperature": 18.3,
"condition": "Cloudy"
},
// ... for the rest of the week
]
},
{
"location": "New York",
"forecast": [
{
"day": "Monday",
"temperature": 10.5,
"condition": "Cloudy"
},
{
"day": "Tuesday",
"temperature": 12.3,
"condition": "Rainy"
},
// ... for the rest of the week
]
},
{
"location": "Miami",
"forecast": [
{
"day": "Monday",
"temperature": 25.5,
"condition": "Sunny"
},
{
"day": "Tuesday",
"temperature": 26.3,
"condition": "Sunny"
},
// ... for the rest of the week
]
}
]
San Francisco: XX
New York: XX
Miami: XX