#internet-computer #candid #idl #dfinity #json #cargo-binstall #read

idl2json

Converts the candid interface description language to JSON

13 releases

0.10.1 Mar 6, 2024
0.9.3 Mar 4, 2024
0.9.2 Sep 30, 2023
0.8.8 Jun 19, 2023

#520 in Parser implementations

Download history 730/week @ 2024-01-22 1140/week @ 2024-01-29 1046/week @ 2024-02-05 642/week @ 2024-02-12 1000/week @ 2024-02-19 908/week @ 2024-02-26 1445/week @ 2024-03-04 486/week @ 2024-03-11 764/week @ 2024-03-18 634/week @ 2024-03-25 637/week @ 2024-04-01 761/week @ 2024-04-08 702/week @ 2024-04-15 1333/week @ 2024-04-22 637/week @ 2024-04-29 951/week @ 2024-05-06

3,650 downloads per month
Used in idl2json_cli

Apache-2.0

41KB
757 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

~6–15MB
~174K SLoC