cannot use json_msg (type []byte) as type string in function argument
收到此后,我尝试将[]byte数组转换为字符串或空接口。但我似乎无法让它正常工作。有什么想法吗?相关代码如下:
type Message struct {
Id int
Name string
}
for _, row := range rows {
m := Message{row.Int(0), row.Str(1)}
json_msg, err := json.Marshal(m)
if err == nil {
panic(err)
}//if
//tried below to print out a interface, didn't work either
//var f interface{}
//err = json.Unmarshal(json_msg, &f)
fmt.Fprintf(c.ResponseWriter, json_msg)
}//for