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

How to create pbjson_types::Value from serde_json::Value #96

Open
banool opened this issue Mar 26, 2023 · 0 comments
Open

How to create pbjson_types::Value from serde_json::Value #96

banool opened this issue Mar 26, 2023 · 0 comments

Comments

@banool
Copy link

banool commented Mar 26, 2023

So I have a serde_json::Value and I want to convert it into a pbjson_types::Value. I need this because my proto file defines a field with the type google.protobuf.Value. I've looked through the source quite a bit and I'm really not sure how to do this. It seems like you can only build pbjson_types::Value from either primitive types, other pbjson_types, or a serde serializer.

My assumption was I'd be able to call something like pbjson_types::Value::from(my_value) and it'd just work if my_value implements serde Serialize, but that doesn't seem to be the case. So I've tried to convert it to serde_json::Value myself first, but there is still no way to convert from that to pbjson_types::Value.

I've read the other issues and some tests in the code but can't figure it out. So any help would be much appreciated.

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