#internet-computer #idl #candid #dfinity #json

idl2json

Converts the candid interface description language to JSON

7 releases

0.9.2 Sep 30, 2023
0.9.1 Sep 30, 2023
0.8.8 Jun 19, 2023

#682 in Parser implementations

Download history 724/week @ 2023-11-03 1463/week @ 2023-11-10 1205/week @ 2023-11-17 2003/week @ 2023-11-24 1144/week @ 2023-12-01 855/week @ 2023-12-08 1163/week @ 2023-12-15 307/week @ 2023-12-22 261/week @ 2023-12-29 725/week @ 2024-01-05 818/week @ 2024-01-12 940/week @ 2024-01-19 923/week @ 2024-01-26 1119/week @ 2024-02-02 930/week @ 2024-02-09 752/week @ 2024-02-16

3,809 downloads per month
Used in idl2json_cli

Apache-2.0

39KB
717 lines

idl2json

Reads Candid textual values from stdin and emits them as json values on stdout.

This command is useful for piping the output of Candid value producing tools (such as dfx) into json tools.

dfx canister call governance get_proposal_info 1 | idl2json

There is sample output to play with without dfx:

<samples/proposal.idl ./target/debug/idl2json

Install

With cargo binstall

cargo binstall will install a pre-built binary, if available, else compile from source:

cargo binstall idl2json_cli --no-confirm

With cargo install

cargo install will download, compile and install:

cargo install idl2json_cli

Build

Build with any of the following methods. The binary executable will be at idl2json/target/{debug,release}/idl2json (depending on whether cargo build --release is used).

With nix:

nix-shell --command 'cargo build'

Build OSX without nix

brew install libiconv
export LIBRARY_PATH=/usr/local/Cellar/libiconv/1.16/lib/
cargo build

Dependencies

~5.5–8.5MB
~133K SLoC