I'm still learning Go (coming from Python) and I'm trying to automate a task in AWS. I have this requirement at work that I need to write the JSON output to a file but I'm struggling how to print all the fields in my struct. I'm missing the Basket
field.
I want it to be printed like this:
{
"Basket": [
{
"Name": "Apple",
"Color": "Red"
},
{
"Name": "Banana",
"Color": "Yellow"
}
]
}
But I'm only getting this:
[
{
"Name": "Apple",
"Color": "Red"
},
{
"Name": "Banana",
"Color": "Yellow"
}
]
You can find my code here in Go Playground.