I have following structs
type logs struct {
Email string
Account string
BranchName string `json:"branch_name"`
Token string
Actions []action
}
type action struct {
time string
name string
data string
}
And code to parse
func logsHandler(writer http.ResponseWriter, request *http.Request) {
decoder := json.NewDecoder(request.Body)
var l logs
err := decoder.Decode(&l)
if err != nil {
panic(err)
}
writeResponse("ok", http.StatusOK, writer)
sendLogsEmail(l)
}
And json
{
"email": "some@mail.ru",
"account": "some_account",
"branch_name": "some_branch",
"token": "some_token",
"actions": [
{
"time": "12:12:12",
"name": "some_name",
"data": "some_data"
},
{
"time": "12:12:12",
"name": "some_name1",
"data": "some_data1"
}
]
}
And I get output when parse
{some@mail.ru some_account some_branch some_token [{ } { }]}
What am I doing wrong ?