func (w *Worker) makeUnaryRequest(ctx *context.Context, reqMD *metadata.MD, input *dynamic.Message) error {
...
}
I need to modify the contents of input.
var data Response
payload_dataByte, _ := json.Marshal(input)
payload_dataRaw := json.RawMessage(string(payload_dataByte))
_ = json.Unmarshal(payload_dataRaw, &data)
data.Updates[0].Entry.Metadata.Description = "18"
But I am having issues in converting it back to proto.Message or dynamic.Message.
new_input := &v1.SetRequest{}
data_byte, err := json.Marshal(data)
if err != nil {
return err
}
data_raw_byte := json.RawMessage(data_byte)
if err := json.Unmarshal(data_raw_byte, new_input); err != nil {
log.Fatalf("Unmarshal error: %v", err)
}
I get an error saying
2025/03/10 23:46:29 Unmarshal error: json: cannot unmarshal string into Go struct field Datapoint.updates.entry.value.timestamp of type timestamppb.Timestamp
exit status 1