Fri, Apr 10, 2015 Goâs encoding/json package makes it really easy to marshal structs to JSON data. package main import ( "encoding/json" "os" "time" ) type MyUser struct { ID int64 `json:"id"` Name string `json:"name"` LastSeen time.Time `json:"lastSeen"` } func main() { _ = json.NewEncoder(os.Stdout).Encode( &MyUser{1, "Ken", time.Now()}, ) }
{{#tags}}- {{label}}
{{/tags}}