第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

無法在 golang 中解析復(fù)雜的 json

無法在 golang 中解析復(fù)雜的 json

Go
三國(guó)紛爭(zhēng) 2021-06-19 18:13:00
我想解析這個(gè) JSON(在 config/synch.conf 中):{    "period" :"yy",    "exec_period" :          {            "start" : {                "month" : 1,                "week" : 2,                "day" : 3,                "hour" : 4,                "minute" : 5            },            "end" : {                "month" : 6,                "week" : 7,                "day" : 8,                "hour" : 9,                "minute" : 10            }        },    "backup" : [        {            "local_dir" : "directoryLo1",            "server_dir" :  "directoryLo2",            "server_host" : "domaineName"        },        {            "local_dir" : "directoryLo1",            "server_dir" :  "directorySe2",            "server_host" : "domaineName"        }    ],    "incremental_save" : "1Y2M"}有了這個(gè)程序:package mainimport (    "encoding/json"    "fmt"    "io/ioutil")func main() {    content, err := ioutil.ReadFile("config/synch.conf")    if err == nil {        type date struct{            month float64            week float64            day float64            hour float64            minute float64        }        type period struct{            start date            end date        }        type backupType []struct{            local_dir string            server_dir string            server_host string        }        type jason struct{            period string            exec_period period            backup backupType            incremental_save string        }        var parsedMap jason        err := json.Unmarshal(content, &parsedMap)        if err!= nil {            fmt.Println(err)        }        fmt.Println(parsedMap)    } else {        panic(err)    }}哪個(gè)不能按預(yù)期工作,因?yàn)檩敵鍪牵簕 {{0 0 0 0 0} {0 0 0 0 0}} [] }這是 play.golang.org http://play.golang.org/p/XoMJIDIV59 上的相同示例我不知道這是否可以使用 go,但我想獲取json.Unmarshal存儲(chǔ)在 map[string]interface{}(或允許這樣做的另一個(gè)對(duì)象)中的函數(shù)的值,例如,該值一分鐘結(jié)束(10)是這樣的:parsedMap["exec_period"]["end"]["minute"],但我不uderstand“通用JSON withinterface {}”的一部分,JSON和圍棋在golang.org
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 218 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)