Following tutorial about usage of encoding/json should address your question.
https://tutorialedge.net/golang/parsing-json-with-golang/ BR, Roland Am Sonntag, 25. September 2022 schrieb Vishnu B <vishnu.net...@gmail.com>: > 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 . > -- 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/CA%2B8p0G0GoA9SVq_UyQ2D27n_0UT16%3DUce9ATcTj_Aoi0QPrpZA%40mail.gmail.com.