-
Notifications
You must be signed in to change notification settings - Fork 123
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
adding support for json #83
Comments
We'd definitely like to add JSON support. Some complicating factors are a planned transition to "Proto JSON" from the previous "Amino JSON" was put on hiatus, or at least that's my understanding, but it may be out-of-date. It'd be good to examine current and future strategies for JSON support in tendermint-rs so we can align with what they're doing, and ideally reuse some of their work: |
@tony-iqlusion Can we use |
@devashishdxt unfortunately it seems like the JSON that's required (e.g. by See ample discussion on informalsystems/tendermint-rs#654 |
What if we add struct attributes ? |
If there's consensus that Cosmos SDK will eventually migrate to Protobuf JSON, then I'm fine with using something like |
relevant cosmwasm discussion CosmWasm/cosmwasm#1448 |
Any updates on this? I'm trying to build a cosmos-ledger library and running into a wall. I need to be ale to convert an Any into JSON to display on the ledger, and can't figure out how to move forwards. |
As a side note, is there currently any workaround I can use to get this functionality? I've been trying for an hour or two and I can't seem to come up with a way to get json from an Any, or any of the other message types for that matter. |
Instead you'll first need to convert it to the appropriate concrete type for a Again, that's something we can potentially support, although AFAIK everything else is currently using the legacy Amino JSON so it won't provide interop. But it would work for your kind of use case, or if someone wanted to build a JSON RPC API. |
Yes sorry I wasn't completely clear, I don't need to convert to json for Any, but rather for all of types that are Msg. Even just |
No, we don't want to add a bespoke JSON format. It really needs to be |
Gotcha, so am I stuck with re-deriving all the Msg structs myself? Or do you see another way for me to achieve that? |
A PR adding |
I have no experience with that library and I'm not really sure what that would entail. Which types in particular should pbjson be applied to? Would this just apply to the types in cosmrs? or are you talking about all the proto definitions? |
It automatically builds |
Fixed in #471 |
messages in the tx are encoded with protobuf,
need to know class first to decode by
typeurl
if those messages can be parsed into serde_json, it would be easy to display
how about adding serde json support in compiling rust files from proto files?
(in prost)
The text was updated successfully, but these errors were encountered: