You are getting an error because {{.QuotesJSON}} is parsed as JavaScript, and your editor is correct, it is not valid JavaScript. I think what you should do instead of this is serialize the JSON into a slice of structs, then loop through each slide with a {{range .yourSlice}} statement. But if you really want to assign the resulting JSON into a variable, then you can either turn off your diagnostics or just live with the errors.