Thanks a lot for your reply!! You are right it's working. But, it could be possible to avoid calling "make"...
El mié., 19 de dic. de 2018 a la(s) 08:14, Ozone Kawakami ( kawakami.oz...@gmail.com) escribió: > Your code `make(pos, 1)` seems to be typo. > The fixed version works well. > https://play.golang.org/p/gnLe_Xi2-nb > > 2018年12月19日(水) 10:40 Juan Mamani <juanmamanichar...@gmail.com>: > >> I'm not an expert but I do my best. >> >> Original json format required: >> { "pos": [{ "lp" : "WISE-12", "lat": "-33,43565400", "lon" : >> "-70,60552700", "speed" : "102" }] >> } >> >> Json autogenerated from: https://mholt.github.io/json-to-go/ (lazy style >> but it works. Even more when my boss is surrounding like a shark! jajaa) >> >> type AutoGenerated struct { Pos []struct { Lp string >> `json:"license_plate"` Lat string `json:"lat"` Lon string `json:"lon"` >> Speed string `json:"speed"` } `json:"pos"` } >> >> So I tried more fancy style but it doesn´t work:( >> >> type track struct{ Lp string `json:"license_plate"` Lat string >> `json:"lat"` Lon string `json:"lon"` >> Speed string `json:"speed"` >> } type pos struct{ Position []track `json:"pos"` } >> >> x := pos{ Position:[{Lp:"DEMO" , >> Lat:"-33.3244",Lon:"-33.391134",Speed:"80", } ]} >> >> Somebody gave me a hand with this: >> >> track := make(pos,1) >> track[0].Lp = "EEE" >> track[0].Lat = "-23.243423" >> track[0].Lon = "-24.2344123" >> track[0].Speed = "50" >> >> Data2Send := pos{track} >> >> But it doesn't keep "pos" when I check Data2Send with >> fmt.Printf("%v",Data2Send). >> Any idea? "Is any out there?" >> >> Thanks >> >> -- >> 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. >> For more options, visit https://groups.google.com/d/optout. >> > -- 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. For more options, visit https://groups.google.com/d/optout.