您必须将要封送的字段公开。像这样:
type Address struct { Street string Extended string City string State string Zip string}err是
nil因为所有的出口领域,在这种情况下有没有,是正确编组。
工作示例:https :
//play.golang.org/p/9NH9Bog8_C6
查看文档http://godoc.org/encoding/json/#Marshal

您必须将要封送的字段公开。像这样:
type Address struct { Street string Extended string City string State string Zip string}err是
nil因为所有的出口领域,在这种情况下有没有,是正确编组。
工作示例:https :
//play.golang.org/p/9NH9Bog8_C6
查看文档http://godoc.org/encoding/json/#Marshal