I am new to golang, I have a function that receives the JSON data as bytes(data variable) I want to send that data to a struct(Item Struct), When I use the data or string(data) it doesn't accept it. if it uses JSON ( {Type:"NETFLOW_V5",ObservationPointID:0,ObservationDomainID:0,TimeReceived:1664011665,IcmpName:""}, }) directly it accepts it. How do I use the data variable in the struct?
func (d *BigQueryDriver) Send(key, data []byte) error { items := []*Item{ {Type:"NETFLOW_V5",ObservationPointID:0,ObservationDomainID:0,TimeReceived:1664011665,IcmpName:""}, } if err := inserter.Put(context.Background(), items); err != nil { return err } return nil -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/3d66cd8a-938d-4aab-a027-4c3b3a6f3ad2n%40googlegroups.com.