Hello,

I'm unable o create dynamically the given JSON structure.
I need the following JSON structure for a linechart with two  timeseries:
[
[{
"time": 1410048000000,
"val": 2182257289.448362
}, {
"time": 1410134400000,
"val": 1693164286.4698827
}, {
"time": 1410220800000,
"val": 0
}],
[{
"time": 1410048000000,
"val": 1600071082.4768825
}, {
"time": 1410134400000,
"val": 1243405427.1394928
}, {
"time": 1410220800000,
"val": 0
}]
]




 I'm new to golang and I tried many things. But nothing works. My last 
trial:
type tChartValue struct {
Time  string  `json:"time"`
Value float32 `json:"value"`
}

type tChartSerie struct {
Values []tChartValue
}

var timeSeries tChartSerie

for j := 1; j < 3; j++ {

var chartValues []tChartValue

for i := 1; i < 4; i++ {

chartValues = append(chartValues, tChartValue{Time: "2016090815" + 
strconv.Itoa(15+i), Value: float32(i * j)})

}

timeSeries.Values = append(timeSeries.Values, chartValues...)

}

Can anyone help

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to