Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
encoding/json: strange isEmptyValue behavior with arrays #31189
What version of Go are you using?
$ go version go version go1.12.1 linux/amd64
Does this issue reproduce with the latest release?
Yes, it does.
What operating system and processor architecture are you using?
I believe the behavior you're seeing is correct.
A zero-length array is empty:
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.