Converting List[Map[String, Any]] to Option[com.google.protobuf.struct.Struct] using Scalapb

333 Views Asked by At

I am trying to convert List[Map[String, Any] to Option[com.google.protobuf.struct.Struct] using Scalapb:

Proto:

message IOTDecodeRequest {
  string id = 1;
  string user_id = 2;
  bytes raw_data = 3;
}

message DecodeResult {
  google.protobuf.Struct decoded = 1;
}

I need to store:

 val rawdata: List[Map[String, Any]] =
   List(
     Map("Userid" -> 860267, "height " -> 0.062),
     Map("userid" -> 860268, "height " -> 0.062)
   )

into DecodeResult using Scala.

How can I do the conversion?

0

There are 0 best solutions below