One of the most frustrating things with Go is how it handles empty arrays when encoding JSON. Rather than returning what is traditionally expected, an empty array, it instead returns null. For example, the following:
This occurs because of how the json package handles nil slices:
Array and slice values encode as JSON arrays, except that byte encodes as a base64-encoded string, and a nil slice encodes as the null JSON value.
There are some proposals to amend the json package to handle nil slices: