-
-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
empty array will be send out as null #457
Comments
@ScriptType this is how the Golang JSON encoder works:
From https://pkg.go.dev/encoding/json#Marshal What should the default behavior be? Should it be to send no body, |
Hi both I experienced a similar situation and was a little surprised too. I would have expected that if |
Yep You are right didn't read the docs well enough, my bad.(and im pretty new to go) It still Suprises me to be honest :P. But yea not a Hma problem so closed |
i have following type which im returning.
type InstanceArrayResponse struct {
Body []*InstanceBody
}
if the Body is now an empty array i get null as a response when testing the api.
fmt.Println(instancesResponse) //&{[]}
so &{[]} is what i`m returning in the handler but in the frontend i receive null :/
When the array is Filled with values its working as expected.
The text was updated successfully, but these errors were encountered: