type ListUsersResponse struct {
Users []User `json:"users"`
}
in Go. It's pretty common have code like userRows := db.Query(...)
var users []api.User
for _, user := range userRows {
users = append(users, api.User{...})
}
where you don't _really_ intend for the default nil-ness to leak out. (Apologies for any broken syntax, I'm realizing in real time that it's been a while since I've written Go)This is definitely not what I expect in other language. I would argue this is a quick of Go though and not JSON's fault.
That seems like a bad default to me.
Just look at the inane rules for map and slice access, what gets nil, what gets the zero value, which built-in mist be used. Even if that were consistent, then you'd still left to wonder if json.field was truly zero or not there.