how is a nil map not null? It certainly isn’t a zero-valued map, that would be {}.
var m map[string]int
println(m == nil)There’s a simple reason: most JavaScript parsers reject null. At least in the slice case.
It's more that when building an API that adheres to a specification, whether formal or informal, if the field is supposed to be a JSON array then it should be a JSON array. Not _sometimes_ a JSON array and _sometimes_ null, but always an array. That way clients consuming the JSON output can write code consuming that array without needing to be overly defensive