Why does a non-nil object turn null in the frontend when passed through a template?

I am trying to send an object to the frontend from the backend. When I log this object in the backend, it appears to be non-null, but when I try to alert it in the frontend, it shows as null instead. Here is the relevant code:

...
presentation := &presentationStruct {
  Object: object,
}
log.Errorf("%v", object) // object shows non-null
template.Execute(writer, presentation)
...

// This alerts null
alert({{.Object}})

The object is defined as the following complex type:

map[string]map[string]struct {
  Values []float32
  MapData map[int][]struct {
    Name string
    Value float32
  }
}

Could the complexity of the type be the reason why it turns null in the frontend?

Hey there! It might be an issue with Go templates escaping. Sometimes, data isn’t rendered the way you expect coz’ it’s sanitized. Try checking if your template syntax matches Go’s, or even converting complex structures to JSON strings b4 passing. Hope this helps!

From my experience, this could also be a mismatch in variable names or paths when passing data to the template. Ensure that the variable name used within the template matches exactly with what is defined in the Go code. Double-check the syntax used within the template, as even a small discrepancy can result in null or unexpected values. Another thing is to make sure the server side sends data correctly formatted that the template can recognize and parse without issues. Checking these elements might help resolve the problem.