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
Encoder return empty json object "{}" In case of encoding struct that has a child as pointer with omitempty tag and this child has first field with value of zero byte (false or 0 or empty string)
ptrToPtr(p) in this case return not a pointer but value
The text was updated successfully, but these errors were encountered:
JekaNS
changed the title
Empty result in case of zero first byte after pointer
Empty encode result in case of zero first byte after pointer
Mar 23, 2024
Same bug with empty string. I've updated the test code and result in the first post.
Also I tried this on different architectures. Bug is reproduced on all of them:
go version go1.20.1 linux/amd64
go version go1.21.6 linux/arm64
go version go1.21.3 darwin/arm64
JekaNS
changed the title
Empty encode result in case of zero first byte after pointer
BUG: Empty encode result in case of zero first byte in child struct as pointer with omitempty tag
Mar 23, 2024
Encoder return empty json object "{}" In case of encoding struct that has a child as pointer with omitempty tag and this child has first field with value of zero byte (false or 0 or empty string)
Here is the test cases to reproduce:
Tests run result:
I thik problem is here
go-json/internal/encoder/vm/vm.go
Line 585 in df897ae
ptrToPtr(p) in this case return not a pointer but value
The text was updated successfully, but these errors were encountered: