You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func (m *Map) UnmarshalJSON(b []byte) error { // ptr here
var stuff map[string]interface{}
err := json.Unmarshal(b, &stuff)
if err != nil {
return err
}
if *m == nil { // if map that this pointer points to is nil:
*m = Map{} // allocate new one
}
for key, value := range stuff {
(*m)[key] = value
}
return nil
}
The text was updated successfully, but these errors were encountered:
I've tried to bind from JSON request struct:
And it turned out that it crashes on slices.Map on line 51 with
assignment to entry in nil map
https://github.com/gobuffalo/pop/blob/master/slices/map.go#L51
Small change to UnmarshalJSON seems to fix issue:
The text was updated successfully, but these errors were encountered: