Allow the client CLI to output JSON.
Right now, the client outputs the data in a misc format (I assume it's the Rust debug object format).
For example:
q as 0e08fa43f3394a96d86554666415441ce726fff24606449d5639471704a1e31a
produces:
>> Getting latest account state
Latest account state is:
Account: 0e08fa43f3394a96d86554666415441ce726fff24606449d5639471704a1e31a
State: Some(
AccountStateBlob {
Raw: 0x010000002100000001217da6c6b3e19f1825cfb2676daecce3bf3de03cf26647c78df00b371b25cc9744000000200000000e08fa43f3394a96d86554666415441ce726fff24606449d5639471704a1e31a0094357700000000000000000000000000000000000000000000000000000000
Decoded: Ok(
AccountResource {
balance: 2000000000,
sequence_number: 0,
authentication_key: 0x0e08fa43f3394a96d86554666415441ce726fff24606449d5639471704a1e31a,
sent_events_count: 0,
received_events_count: 0,
},
)
},
)
Whereas the JSON output would look something like:
{
"Account": "0e08fa43f3394a96d86554666415441ce726fff24606449d5639471704a1e31a",
"State": {
"Raw": "0x010000002100000001217da6c6b3e19f1825cfb2676daecce3bf3de03cf26647c78df00b371b25cc9744000000200000000e08fa43f3394a96d86554666415441ce726fff24606449d5639471704a1e31a0094357700000000000000000000000000000000000000000000000000000000",
"Decoded": {
"balance": 2000000000
....
}
}
}
It doesn't need to be super clean for V1 I think - just valid JSON!
Is your feature request related to a problem? Please describe.
This would make it much easier to build out the ecosystem. For example, https://libranaut.io/ is is pulling data by piping through the CLI, and regex parsing the results. This is obviously highly prone to breaking in unexpected ways, and much more work than just parsing JSON.
I think providing the JSON output option is probably a quick win to help the dev community bootstrap the ecosystem.
Describe the solution you'd like
A --json flag when booting the CLI (or maybe even a --format json option, to allow other formats in future)
Describe alternatives you've considered
It seems to me that #83 fixes this as well - I'm getting JSON responses from the client.
Seems this has been addressed?
Most helpful comment
It seems to me that #83 fixes this as well - I'm getting JSON responses from the client.