New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
panic: json: cannot unmarshal object into Go struct field Payload.Data of type main.Key #342
Comments
There is an incompatible behavior. |
|
oh, yep, you're right! good catch |
but in that case I don't think that and... will this feature be supported? 😅 should I file another issue as feature request? |
someone smarter than me pointed out today that I verified that the so adding support for custom unmarshalers on map keys is needed for this library to be compliant with the std lib; allowing to use it like jsoniter would be just additional sugarcoat edit: I just realized after providing the goplay.space link that actually that works just fine in |
fix goccy#342 The map key decoder has an incompatible behavior when the type kind is string and the type has UnmarshalJSON.
fix: an incompatible behavior on map key decoder
we're still evaluating go-json as replacement for jsoniter on our setup, and during our testing I've found another issue where go-json wouldn't be able to parse valid json that both
encoding/json
andjsoniter
parse just finethis time it seems to be caused by using custom types with custom unmarshal functions as map keys
when attaching the debugger with a breakpoint on the
UnmarshalJSON
function I can't see the function being called at all, so it seems to be panicking somewhere earlierreproducible by:
note: just by removing (or commenting out) the
func (key *Key) UnmarshalJSON(b []byte)
function will make the parsing successful, so it doesn't look like a specific issue just because of custom types as map keysThe text was updated successfully, but these errors were encountered: