This library parses Internet Computed IDL (candid) to JSON format.
Install library from npmjs:
npm install @tookey-io/candid-parser
# or
pnpm install @tookey-io/candid-parser
# or
yarn add @tookey-io/candid-parser
# or
Load and use:
import {parseIdlPretty, parseIdl } "@tookey-io/candid-parser";
const did = `
service : {
foo: () -> (nat) query;
bar: () -> (text) query;
}
`
const jsonPretty = parseIdlPretty(did)
const jsonMinimized = parseIdl(did)