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

Deserialization of Base 64-encoded strings into byte arrays is not working #520

Closed
alvarosanchez opened this issue Jul 18, 2023 · 0 comments · Fixed by #524
Closed

Deserialization of Base 64-encoded strings into byte arrays is not working #520

alvarosanchez opened this issue Jul 18, 2023 · 0 comments · Fixed by #524
Assignees
Labels
type: bug Something isn't working

Comments

@alvarosanchez
Copy link
Member

alvarosanchez commented Jul 18, 2023

Micronaut Serialization fails when trying to deserialize a String that is Base 64-encoded into a byte[], such as:

eyJzaXplIjoxMDAwLCJlbmNyeXB0ZWQiOmZhbHNlLCJ3b3JrZmxvd0lkIjoxfQ== which decodes as {"size":1000,"encrypted":false,"workflowId":1}

@alvarosanchez alvarosanchez added the type: bug Something isn't working label Jul 18, 2023
yawkat added a commit that referenced this issue Jul 19, 2023
jackson-databind writes byte[] as base64 and supports reading from base64 or array. Serde 2 writes byte[] as array, but does not support reading from base64, so prior to this change we are only compatible with jackson in one direction (serde encoder -> jackson decoder).

This patch adds decode support for base64, and for the bson binary type. For oracle jdbc json, a decodeBinary method already exists.

On the encode side, there is now a config flag to use format-specific byte array encoding, which is base64 for json. The default remains to write an array of numbers.

Fixes #520
yawkat added a commit that referenced this issue Jul 19, 2023
jackson-databind writes byte[] as base64 and supports reading from base64 or array. Serde 2 writes byte[] as array, but does not support reading from base64, so prior to this change we are only compatible with jackson in one direction (serde encoder -> jackson decoder).

This patch adds decode support for base64, and for the bson binary type. For oracle jdbc json, a decodeBinary method already exists.

On the encode side, there is now a config flag to use format-specific byte array encoding, which is base64 for json. The default remains to write an array of numbers.

Fixes #520
yawkat added a commit that referenced this issue Jul 20, 2023
* Support decoding base64 to byte[]
jackson-databind writes byte[] as base64 and supports reading from base64 or array. Serde 2 writes byte[] as array, but does not support reading from base64, so prior to this change we are only compatible with jackson in one direction (serde encoder -> jackson decoder).

This patch adds decode support for base64, and for the bson binary type. For oracle jdbc json, a decodeBinary method already exists.

On the encode side, there is now a config flag to use format-specific byte array encoding, which is base64 for json. The default remains to write an array of numbers.

Fixes #520

* address review

* rename config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants