Skip to content

JSON.Classify can't classify bigints #256

@tx46

Description

@tx46

there's no type-safe way to serialize them because of this i think:

  let stringifySafe = v =>
    JSON.stringifyAnyWithReplacer(v, (k, v) =>
      switch typeof(v) {
      | #bigint =>
        let bi = (Obj.magic(v) :> BigInt.t)
        JSON.Encode.string(bi->BigInt.toString ++ "n")
      | _ => v
      }
    )

fix: add BigInt to JSON.Classify? (i recall support for @unboxed BigInt.t being added rather recently)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions