vue-codemirror json格式化精度数据丢失 json-bigint

作者: tww844475003 分类: 前端开发 发布时间: 2021-05-22 19:06
const key = '{"a":1, "b":1.00000000000000000,"key": 1234567890123456789}'
      const JSONbigString = require('json-bigint')({storeAsString: true})
      const withString = JSONbigString.parse(key)
      console.log('key:', key)
      console.log('jsonBigint:', withString)
      console.log('jsonParse:', JSON.parse(key))
      this.codemirror.setValue((JSON.stringify(withString, null, 2)))
前端开发那点事
微信公众号搜索“前端开发那点事”

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注