github.com/qiuhoude/go-web@v0.0.0-20220223060959-ab545e78f20d/prepare/06_xmljson/json/types.go (about)

     1  package json
     2  
     3  type (
     4  	Server struct {
     5  		// ID 不会导出到JSON中
     6  		ID int `json:"-"`
     7  		// ServerName 的值会进行二次JSON编码
     8  		ServerName  string `json:"serverName"`
     9  		ServerName2 string `json:"serverName2,string,omitempty"`
    10  		// 如果 ServerIP 为空,则不输出到JSON串中
    11  		ServerIP string `json:"serverIP,omitempty"`
    12  	}
    13  	Serverslice struct {
    14  		Servers []Server
    15  	}
    16  )