Closed easykoo closed 10 years ago
Hi @easykoo. Can you provide more information and a case to reproduce this?
Thanks, @mholt. I found the root cause, the two structs has the same field named 'id'. I think I just need to change the form name.
type Role struct {
Id int `form:"id"` //should change to 'roleId'
Description string `form:"description"`
}
type User struct {
Id int `form:"id"`
Username string `form:"username"`
Role Role `json:"role_id"`
}
Ah, yes, that's probably because form bodies have a flat structure, so if field names overlap, the deserializer gets confused. Glad you figured it out!
when struct has a struct field, it will miss values