Closed martinxsliu closed 1 year ago
Its weird to me that this isn't the default.
+1
I think this might an issue with the google-protobuf gem and not this gem.
irb(main):008:0> b = ::Protobuf::Rpc::DynamicDiscovery::Beacon.new(:beacon_type => "FLATLINE")
=> #<Protobuf::Rpc::DynamicDiscovery::Beacon beacon_type=#<Protobuf::Enum(Protobuf::Rpc::DynamicDiscovery::BeaconType)::FLATLINE=1> s...
irb(main):009:0> b.to_json
=> "{\"beacon_type\":1}"
This issue should be opened here instead https://github.com/protocolbuffers/protobuf
Hi, is there a way to configure the JSON serializer to emit enum values as integers instead of strings (c.f. https://developers.google.com/protocol-buffers/docs/proto3#json_options). For example, the Go library has the
EnumAsInts
flag. I've tried splunking through the code but I haven't had any luck.Without it, consumers of JSON serialized data are not forwards compatible as they cannot deserialize unknown string values.