Firebase 云函数数据无法编码 BigInt
Firebase Cloud Function Data cannot be encoded BigInt
我专门与 Square API 合作,他们经常使用 bigint 类型。有没有一种简单的方法可以将此 bigint 编码为字符串?
错误:
Data cannot be encoded in JSON. 1634864610834n
您可以通过将闭包作为第二个参数传递给 JSON.stringify()
和 JSON.parse()
方法来检查 BigInt
并转换 to/from 字符串。这是一篇包含更多信息的精彩文章。
我专门与 Square API 合作,他们经常使用 bigint 类型。有没有一种简单的方法可以将此 bigint 编码为字符串?
错误:
Data cannot be encoded in JSON. 1634864610834n
您可以通过将闭包作为第二个参数传递给 JSON.stringify()
和 JSON.parse()
方法来检查 BigInt
并转换 to/from 字符串。这是一篇包含更多信息的精彩文章。