【发布时间】:2021-12-11 01:58:22
【问题描述】:
我专门使用 Square API,他们经常使用 bigint 类型。有没有一种简单的方法可以将此 bigint 编码为字符串?
错误:
Data cannot be encoded in JSON. 1634864610834n
【问题讨论】:
标签: javascript node.js json typescript google-cloud-functions
我专门使用 Square API,他们经常使用 bigint 类型。有没有一种简单的方法可以将此 bigint 编码为字符串?
错误:
Data cannot be encoded in JSON. 1634864610834n
【问题讨论】:
标签: javascript node.js json typescript google-cloud-functions
您可以检查BigInt 并通过将闭包作为第二个参数传递给JSON.stringify() 和JSON.parse() 方法来转换字符串。这是一篇包含更多信息的精彩文章。
【讨论】: