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
When trying to unmarshal into the interface, the interface decoder is expecting the UnmarshalJSON method to be defined on the underlying struct [source]. Otherwise, it checks if the value is null and ultimately fails if neither condition applies with:
json: cannot unmarshal X into Go value of type X
The standard library behaviour though is handling such situations and does not fail.
When trying to unmarshal into the interface, the interface decoder is expecting the
UnmarshalJSON
method to be defined on the underlying struct [source]. Otherwise, it checks if the value isnull
and ultimately fails if neither condition applies with:The standard library behaviour though is handling such situations and does not fail.
I'm using Go version 1.19.
Code to reproduce this issue
Output of the main function run is:
I can contribute some example test cases if this would be helpful!
The text was updated successfully, but these errors were encountered: