Skip to content

Deserialize bytes (i.e. Vec<U8>) from a json array of integer #121

Description

@lpzantony

Hello,

First of, thank you for your work on pbjson. It saves a lot of handcrafted serde fine tuning. Especially the fact that pbjson can deserialize enums either from their value or from their name, super handy.

One last thing I wonder about pbjson: it seems that the only way to deserialize a Protobuf bytes (i.e. a Vec<u8>) is to have it expressed as a base64 string, like "data": "AAAH4AEM",. If I do submit the following "data": "[ 0, 0, 7, 224, 1, 12 ]",, it returns an error because it expects a base64 string.

I know the official Protobuf's recommendation for JSON mapping does recommend using base64 strings for bytes. I just wonder if it would be possible to also support deserialization of bytes from a JSON int array? Similarly to what is recommended for repeated.

Regards

AL

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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