Skip to content

Conversation

dominikandreas
Copy link

My use-case requires capnp messages to (also) be serialized to json and deserialized from json. This PR adds support for this by converting binary data to a base64 encoded string, which is compatible with json.

The implementation is non-breaking, the previous behavior stays the same, but can be controlled via a msg.to_dict(encode_binary_as_base64=True).

I realize this might be a rare use-case but doesn't hurt to have it as a feature and at least in my case it's useful to have json as a fallback solution in the communication stack for debugging purposes.

Copy link
Collaborator

@haata haata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub Actions seem to be misbehaving. I'm looking into this.

@haata
Copy link
Collaborator

haata commented Sep 4, 2025

Can you rebase, I want to see how the GitHub Actions run after the Python 3.13 updates.
Overall the changes seems good.

@dominikandreas
Copy link
Author

Rebased on master, tests pass locally for me on python 3.13

@haata haata merged commit 237fa7d into capnproto:master Sep 6, 2025
12 checks passed
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

Successfully merging this pull request may close these issues.

2 participants