Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Use RawValue enum when formatting to JSON #252

Open
gregoireLem opened this issue Mar 1, 2019 · 0 comments
Open

[Question] Use RawValue enum when formatting to JSON #252

gregoireLem opened this issue Mar 1, 2019 · 0 comments

Comments

@gregoireLem
Copy link

Description

Version of protoc (protoc --version)

libprotoc 3.6.1

Version of ProtocolBuffers.framework

Protobuf-swift version: 4.0

Description

Here is an enum in my proto file

enum battery_status {
STARTED = 0;
STOPED = 1;
ABSENT = 2;
}

To send it back in JSON, I use battery_status.encode()

I get :

["status": "ABSENT"]

Is there a way that the dictionary outputted uses raw value ?

What I want is to get :

["status":2]

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant