- Language
- Go
- Go version
- 1.24.2
- Core deps
- 1 direct
- Latest tag
- v0.1.4
- License
- Apache-2.0
- Go modules
- 1
Code from the README
goutil.SnakeCase("Lucian Khanakia") // output: luci_khanakia
goutil.SnakeCase("kebab-case") // output: kebab_case
goutil.SnakeCase("Id0Value") // output: id0_value
goutil.SnakeCase("ID0Value") // output: id0_value
goutil.SnakeCase("HTTPRequest") // output: http_requesttype Student struct {
Name string `json:"name"`
RoleNo int `json:"roleNo"`
}
student := Student{
Name: "Lucian",
RoleNo: 7,
}
fmt.Println(goutil.ToJSON(student))
// out: {"name":"Lucian","roleNo":7}
fmt.Println(goutil.ToJSONIndent(student))
// out:
{
"name": "Lucian",
"roleNo": 7
}
goutil.PrintToJSON(student)
// out:
{
"name": "Lucian",
"roleNo": 7
}From the goutil README.