// // $Id$ // package main import ( "encoding/json" "fmt" ) type Response struct { Error bool `json:"error"` Message string `json:"message,omitempty"` Result interface{} `json:"result,omitempty"` } func main() { var resp Response resp.Message = "" jsonBytes, _ := json.Marshal(resp) fmt.Println(string(jsonBytes)) } //EOF
$ go run map.go
{"error":false}