type ApiResponse struct {
Success bool `json:"success"`
Errors []string `json:"errors"`
}
type NewSessionResponse struct {
ApiResponse `json:"apiResponse"`
authToken string `json:"authToken"`
}
In my handler I am doing this:
resp := NewSessionResponse{ApiResponse{true, []string{}}, "auth123"}
json.NewEncoder(w).Encode(resp)
The response I am seeing is this:
{
apiResponse: {
success: true,
errors: [ ]
}
}
Why isn't my authToken property in the JSON result?