Lowercase JSON key names with JSON Marshal in Go
Have a look at the docs for encoding/json.Marshal. It discusses using struct field tags to determine how the generated json is formatted. For example: type T struct { FieldA int `json:”field_a”` FieldB string `json:”field_b,omitempty”` } This will generate JSON as follows: { “field_a”: 1234, “field_b”: “foobar” }