0
Der BeispielcodeWie json Strings in einer Struktur von json docs mit von Abstellungs in golang
package main
import (
"encoding/json"
"fmt"
)
type ClassRoom struct {
Student struct {
Name string
/*
Address struct {
City string
Zip int
} `json:"address"`
*/
Address []string `json:"address"` //here, Want to get json string
Age int `json:"age"`
} `json:"student"`
ClassCode int `json:"code"`
}
func main() {
jsonDocs := `[
{"student":{"name":"jss","address":{"City":"Seoul","Zip":54},"Age":28},"ClassCode":1234}]`
var node []ClassRoom
json.Unmarshal([]byte(jsonDocs), &node)
fmt.Println(node)
}
Ich möchte Adreßvariable von JSON-String-Typ (wie {"City":"Seoul"....}
) zu erhalten.
Thank You !!!^_^ –
@ J.soo, wenn meine Antwort geholfen hat, können Sie es auswählen, indem Sie auf das Häkchen klicken :) – OneOfOne