My bad, if you want to custom your JSON output you should use https://golang.org/pkg/encoding/json/#Marshaler
El lunes, 4 de febrero de 2019, 10:56:53 (UTC-3), Victor Giordano escribió: > > Implemeting the Stringer interface could solve your problem.... > > El martes, 18 de diciembre de 2018, 22:40:45 (UTC-3), Juan Mamani escribió: >> >> 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.