Closed gsindigi closed 4 years ago
Yes, you should call json.Marshal
on the ConstructIETFJSON
output. If you're wanting to skip this step, then the EmitJSON
API that we provide would be preferred. We keep the ConstructIETFJSON
public because there are cases where the user might want the map[string]interface{}
format.
Closing this issue due to inactivity.
The GoStructs are generated in package "oc" for OpenConfig*yang modules, using
generator
tool as described. Seeing issues when tried to unmarshal a json-tree usingytypes.Unmarshal
However, when the such maps are
json.Marshal
ed and generated[]byte
is used as value forfunc Unmarshal(data []byte, destStruct ygot.GoStruct, opts ...ytypes.UnmarshalOpt) error
, I do not see above issues.I was hoping the maps can be directly used with
ytypes.Unamarshal
, which does seem to be having issues. Is this not right usage ? I was expecting the maps to work seamlessly, as they were having right type of values for the fields.Is it always preferred to
json.Marshal
and use marshaled value? Wouldn't this call for an extra step that can be avoided ?