We gaan het deserialiseren van een vrij complexe JSON collectie oefenen met Jackson
Maak een nieuw package en zorg ervoor dat de Jackson bibliotheek baschikbaar is voor het project.
Note: Misschien moet je eerst het Annotatie deel van de JSON theorie nog een keer lezen voordat je deze opdracht probeert.
Schrijf een programma dat in een JSON-bestand het weer voor een stad in een bepaalde week inleest:
De 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