I'm trying to find a way to encode and decode structs (such as corev1.Pod and corev1.Container) to and from strings. Since structs may contain pointers, so use Libraries directly such as json and yaml are not feasible. Is there an easy way to encode and decode these objects to and from strings? I found that client-go provides the String() method, but I did not find the corresponding decoding method.
I'm trying to find a way to encode and decode structs (such as
corev1.Pod
andcorev1.Container
) to and from strings. Since structs may contain pointers, so use Libraries directly such asjson
andyaml
are not feasible. Is there an easy way to encode and decode these objects to and from strings? I found that client-go provides theString()
method, but I did not find the corresponding decoding method.Thank you very much.