@polkadot/primitives-json
Conversion of Polkadot types to and from a structure with Json-only primitives, ready for serialisation. As such, it does not stringify itself, rather converts from complex classes to the correct Json reprsentation.
Usage
Installation -
npm install --save @polkadot/primitives-json
Usage -
const { parachainIdDecode, parachainIdEncode } from '@polkadot/primitives-json');
parachainIdDecode( // step 3 - BN `0x123456`
parachainIdEncode( // step 1 - string `'0x123456'`
new BN('0x123456') // step 0 - BN `0x123456`
)
);