Adding struct tags

Report a typo

Emma is learning to implement structs in Go to control JSON response encoding.

She has asked you to help her add the struct tags to the bankAccount struct based on a simple JSON response of bank account data:

{
  "accountID": "10001",
  "accountType": "savings",
  "balance": 1234.56
}

To solve this task, you don't need to delete or modify any code within the main function. Your only objective is to add the correct struct tags to each one of the bankAccount struct fields.

Sample Input 1:

10001 savings 1234.56

Sample Output 1:

{
  "accountID": 10001,
  "accountType": "savings",
  "balance": 1234.56
}
Write a program in Go
package main

import (
"encoding/json"
"fmt"
"log"
)

type bankAccount struct {
// add the struct tags below!
AccountID int `?:"?"`
AccountType string `?:"?"`
Balance float64 `?:"?"`
}

// DO NOT delete or modify the contents of the main() function!
func main() {
var acc bankAccount
fmt.Scanln(&acc.AccountID, &acc.AccountType, &acc.Balance)

jsonResponse, err := json.MarshalIndent(acc, "", " ")
if err != nil {
log.Println(err)
}
fmt.Println(string(jsonResponse))
}
___

Create a free account to access the full topic