I have ,
{"time": 14990, "timeTaken": 5.43420481682}
I want timeTaken as json.Number so I am trying this -
{"time": 14990, "timeTaken": json.Number(5.43420481682)}
But it is not working.
I have ,
{"time": 14990, "timeTaken": 5.43420481682}
I want timeTaken as json.Number so I am trying this -
{"time": 14990, "timeTaken": json.Number(5.43420481682)}
But it is not working.
json.Number
is internally, a string. Using strconv.FormatFloat
should work.
json.Number(strconv.FormatFloat(123.456, 'e', -1, 64))