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
It seems as though unmarshaling to a struct that contains a slices.Map doesn't work as expected, and the only solution is to adjust the receiver for Map.UnmarshalJSON to be a pointer, as below shows
$ go mod edit -replace github.com/gobuffalo/pop/v5=github.com/naemono/pop/v5@map-unmarshal-pointer-receiver
$ go run map.go
go: downloading github.com/naemono/pop/v5 v5.3.2-0.20210611203100-4a801ab183ef
2021/06/11 15:38:05 err: <nil>, account: &{map[test:data]}
I'll open a PR shortly referencing this issue
Steps to Reproduce the Problem
See above
Expected Behavior
I'd expect the map data to be contained within the slices.Map object with a struct during json.Unmarshal
Actual Behavior
map is empty
Info
If it's relevant
$ go version
go version go1.15 darwin/amd64
The text was updated successfully, but these errors were encountered:
Description
It seems as though unmarshaling to a struct that contains a
slices.Map
doesn't work as expected, and the only solution is to adjust the receiver for Map.UnmarshalJSON to be a pointer, as below showsyou'll see this
If I update UnmarshalJSON to be
like here https://github.com/naemono/pop/tree/map-unmarshal-pointer-receiver
I'll open a PR shortly referencing this issue
Steps to Reproduce the Problem
See above
Expected Behavior
I'd expect the map data to be contained within the slices.Map object with a struct during json.Unmarshal
Actual Behavior
map is empty
Info
If it's relevant
The text was updated successfully, but these errors were encountered: