Suppose you want to decode to the FootballTeams struct a JSON object that contains data of Bundesliga Football teams:
{
"league": "Bundesliga",
"clubs": [
{
"name": "Bayern Münich",
"code": "FCB",
"stadium": "Allianz Arena"
},
{
"name": "Borussia Dortmund",
"code": "BVB",
"stadium": "Signal Iduna Park"
},
... // rest of the teams go here
]
}
We have already created the FootballTeams struct for you, your only task is to write the additional code needed to deserialize the above JSON object to the teams struct variable, and then print its deserialized value.
This problem uses the
bufio package to scan the whitespace-separated strings from the standard input. However, you don't need to know how the bufio package works to solve this task. The only objective is to call the correct function from the encoding/json package to deserialize teamsJSONand then print its deserialized value.