Ich muss komplexes JSON-Objekt zu GO-Struktur marshallen.Komplexes JSON-Marshalling zu GoLang-Objekten
So habe ich Quelle:
"NetworkSettings": {
"Bridge": "",
"SandboxID": "e9736755bc41db307019fde3be0feed51086e6d3e23b0213c59bb5e43f7af214",
"HairpinMode": false,
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "2ee283787f45894c3383229d29ada1ccbb7f34b1c1e143e417e7ba75b7f5ebce",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "1c4788fac19973ddc73975613a2aef5a4cc2be446af458c06fa5fa162e8126ff",
"EndpointID": "2ee283787f45894c3383229d29ada1ccbb7f34b1c1e143e417e7ba75b7f5ebce",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02"
}
}
und ich brauche es in Objekt wie folgt zuzuordnen:
NetworkSettings struct {
IpAddress string
SandboxID string
Gateway string
Ports map[string][]Binding
Networks map[string]map[string]string
}
jedoch wegen Networks map[string]map[string]string
Ich erhalte Fehler
json: cannot unmarshal object into Go value of type string
error restoring containers: json: cannot unmarshal object into Go value of type string
Aber das ist, was ich brauche, um eine komplexe Karte der Kartenstruktur zu haben.
Irgendeine Idee, wie man das macht?