How to parse this json using Go?
timelinedata := '{
"2016-08-17T00:00:00.000Z": 4,
"2016-11-02T00:00:00.000Z": 1,
"2017-08-30T00:00:00.000Z": 1
} '
I want the dates and the values in separate variables by looping over the json. Currently I am doing it in this way
var timeline map[string]int
json.Unmarshal([]byte(timelinedata),
for k, v := range timeline {
new_key := k
new_val := v
println("val--->>", new_key, new_val)
}
The problem is that the output is not in proper order as like the json input is. Every time I run the loop the output order varies. I want to map the json in exact order as like the input. I think I am not maping it in a proper way---