I have to form a slice of structs for the chart. Marshal it, and return to the frontend widget. Widget is waiting for the format like this :
[["1455523840380",1],["1455523840383",2],["1455523840384",3]]
But My data comes like this :
[{"Time":1.45552462158e+12,"Value":1},{"Time":1.45552462158e+12,"Value2},{"Time":1.45552462158e+12,"Value3}]
My struct that is coming to the slice is made like this :
type ChartElement struct {
Time int `json:""`
Value int `json:""`
}
I have now 2 main troubles:
- how to make the json without keys, but just 2 values with comma between them?
- how to convert date or time to the javascript miliseconds correctly?