How to achieve the following with protojson package in Golang?
Protobuf:
type ProtoResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Xesp isActionResponse_Xesp `protobuf_oneof:"xesp"`
TimeTakena string `protobuf:"bytes,9,opt,name=time_takena,json=timeTakena,proto3" json:"time_takena,omitempty"`
}
So, I need to marshal the array of proto into a json. For example,
var protoResps []ProtoResp
How do I marshal this protoResps?
Currently, protojson.Marshal function can marshal ProtoResp but can't marshal []ProtoResp as its slice of proto.
I also need to unmarshal this later back into []ProtoResp
Thanks in advance.