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
would have the desired output you expect, however having a zero-length array is likely not what you'd want. I would use slices instead if that works for your use-case.
Changing this behavior would break people who rely on the current encoding semantics with arrays, so it's likely not going to happen.
What version of Go are you using?
Does this issue reproduce with the latest release?
Yes, it does.
What operating system and processor architecture are you using?
go env
OutputWhat did you do?
https://play.golang.org/p/JTZn-qSksgw
What did you expect to see?
What did you see instead?
Possible solution
Is this behavior is correct? If no:
In
encoding/json
theencode.go
file contains:Since that, any array will never be empty.
Used to fork the package and change it to:
The text was updated successfully, but these errors were encountered: