I have the following structures to export onto json:
type ExportedIncident struct {
Title string `json:"title"`
Host string `json:"host"`
Status string `json:"status"`
Date string `json:"date"`
Notes []ExportedNote `json:"notes"`
LogEntries []ExportedLogEntry `json:"log_entries"`
}
And I want underscore cased fields, so I had to define each field just for that as described in this answer: https://stackoverflow.com/a/11694255/1731473
But it's really cumbersome and I believe there is a simpler solution in Go, but I can't find it.
How can I set default letter-case (underscore, snake, camel...) for JSON export?