http://play.golang.org/p/f6ilWnWTjm
我试图解码以下字符串,但只得到空值。
如何在Go中解码嵌套的JSON结构?
我想将以下内容转换为映射数据结构。
package main
import (
"encoding/json"
"fmt"
)
func main() {
jStr := `
{
"AAA": {
"assdfdff": ["asdf"],
"fdsfa": ["1231", "123"]
}
}
`
type Container struct {
Key string `json:"AAA"`
}
var cont Container
json.Unmarshal([]byte(jStr), &cont)
fmt.Println(cont)
}
json: "name"
。但是这个可以json:"name"
。真是自己打自己的脸! - filthy_wizard