go解析json

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/smilesundream/article/details/82782592
package main                                                                    

import (
    "fmt"
    "encoding/json"
    "strconv"
)

type tt struct {
    TaskId interface{}   `json:"_taskid"`
}
func main() {

    var s = `{"_taskid":152269465677750,"sendtime":11111111111}`    
    var t tt
    fmt.Println(s)
    json.Unmarshal([]byte(s),&t)
    fmt.Println(strconv.FormatFloat(t.TaskId.(float64),'f',-0,64))
}

-0代表精确到小数点后0位。

猜你喜欢

转载自blog.csdn.net/smilesundream/article/details/82782592