What can I do to get k8s to return json in the form of an underscore instead of a camel case

6/3/2019

I need to use client-go to get the state of deployment in k8s, but when json serialization is done, k8s is serialized by camel case by default, while I need to pass it to the front end in the form of underscore division. What do I need to do?

-- Dom.Dou
client-go
kubernetes

1 Answer

6/3/2019

You can create a custom marshaling function for transforming the JSON output from camel case to snake case or you can use this package that does the exact same thing

-- Tinwor
Source: StackOverflow