Cashu-TS - v4.5.1
    Preparing search index...

    Variable JSONIntConst

    JSONInt: JSONIntApi = ...

    BigInt-safe JSON parser/stringifier.

    • Based on Crockford's JSON reference parser approach (recursive descent), adapted for BigInt.
    • Does not touch the global JSON object.
    • Stringifies BigInt as pure JSON numbers (no quotes, no n).

    Gotchas.

    • s === JSONInt.stringify(JSONInt.parse(s)) is generally true for canonical JSON inputs.

    • o !== JSONInt.parse(JSONInt.stringify(o)) can happen because:

      • BigInt is stringified as an unquoted JSON number token (loss of JS type on parse).
      • undefined values are dropped or become null in arrays, per JSON rules.
      • Custom toJSON/replacer behavior can change output.

    There is no consistent way to preserve BigInt type through JSON today, so handling that case is up to users. In Cashu-TS, we use the Amount VO to normalize numbers.