simple go-lang program for parsing json string into self-defined structure.
package main import ( "encoding/json" "fmt" ) type IpInfo struct { ip string `json:"ip"` } type MyData struct { msg string `json:"msg"` status_code int `json:"status_code"` data []IpInfo `json:"data"` } func main() { json_data := []byte(`{"msg": "success", "status_code": 0, "data": [{"ip": "127.0.0.1"}]}`) my_data := MyData{} err := json.Unmarshal(json_data, &my_data) if err != nil { fmt.Println("error:", err) } fmt.Println(my_data.msg) } I got nothing after ran this code, however "success" was expected.