I have been working on a web application using React-Redux and gRPC. The server sends the frontend gRPC messages which the frontend receives with the enums in the form of integers. How can I turn these integer values to their corresponding string values?
I have tried the methods in the protoc generated _pb.js
files (.toObject(), get<Enum>()
, etc.)
message Example {
ExampleType type = 2;
}
enum ExampleType {
UNKNOWN_TYPE = 0;
TEST_TYPE = 1;
OTHER_TYPE = 2;
}
I expect the following shape of the message.toObject()
JSON object:
{ type: string }
However, I receive the following:
{ type: integer }