Skip to content

jsonpb not able to unmarshal when enum marshalled as string #402

@leon-g-xu

Description

@leon-g-xu

I use jsonpb to marshal the protobuf object to json string. Use EnumsAsInts: false so that the enum field is written as a string in json.
But when I use jsonpb to unmarshall it back to protobuf i am getting the following error:
Received unexpected error "unknown value \"ERROR\" for enum logging.LogLevel"

But when I set EnumsAsInts: true and the enum is written as a int, the unmarshal works.
The unmarshal should also be able to unmarshal enum from string, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions