【发布时间】:2016-05-28 12:11:08
【问题描述】:
我尝试在 go 中解组一些嵌套的 JSON,结构沿着这个方向发展
type GameState struct {
missiles []*Missile
others []*Player
you *Player
}
type Message struct {
gamestate *GameState
messagetype string
}
// json like {"gamestate":{...},"messagetype":"stateupdate"}
我还在网上发布了running example。
现在,当我使用 map[string]interface{} 来 Unmarshal 时,所有内容都会被反序列化。但是当我使用结构来 Unmarshal 时,我得到了 nil ,无论是结果还是错误。
怎么会?
【问题讨论】:
标签: json data-structures go