Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Do not know how to serialize a BigInt

function toJson(data) {
    return JSON.stringify(data, (_, v) => typeof v === 'bigint' ? `${v}n` : v)
        .replace(/"(-?d+)n"/g, (_, a) => a);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Do #serialize #BigInt
ADD COMMENT
Topic
Name
5+7 =