Skip to main content

MarshalObjToStruct

Marshals an object into a structpb.Struct. It uses jsonPb for proto messages and the standard JSON marshaler for other types.

def MarshalObjToStruct(
input: interface{}
) - > *structpb.Struct, error

Marshals an object into a struct. It uses jsonPb if the input is a proto message; otherwise, it uses the json marshaler.

Parameters

NameTypeDescription
inputinterface{}The object to be marshaled into a struct. This can be a proto message or any other Go type that can be marshaled to JSON.

Returns

TypeDescription
*structpb.Struct, errorA pointer to a structpb.Struct representing the marshaled object, or an error if marshaling fails.