利用omitempty
type SendTBArgs struct {`
Amount *big.Int `json:"amount"`
Sign string `json:"sign"`
NodeID string `json:"nodeId,omitempty"`
}
本文探讨了Go语言中omitempty字段在SendTBArgs结构体中的使用,重点讲解如何通过该特性控制JSON序列化时的字段显示。
利用omitempty
type SendTBArgs struct {`
Amount *big.Int `json:"amount"`
Sign string `json:"sign"`
NodeID string `json:"nodeId,omitempty"`
}

被折叠的 条评论
为什么被折叠?