JQ Transform修改数字吗?我该如何克服? [英] is JQ Transform modifying numbers? How can I get past it?

查看:123
本文介绍了JQ Transform修改数字吗?我该如何克服?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么这样(jqplay.org中的过滤器"): {"key":633447818234478180}

Why this ("Filter" in jqplay.org): {"key":633447818234478180}

返回以下内容(jqplay.org中的结果"): {"key":633447818234478200}

returns this ("Result" in jqplay.org): {"key": 633447818234478200}

原始JSON没关系.

为什么将180变成200?我该如何克服呢?这是一个错误吗?数字太大了吗?

Why is it changing 180 into 200? How can I overcome this? Is this a bug? A number too big?

推荐答案

我相信这是因为jq只能表示合法的JSON数据,并且您给出的数字超出了可以表示的范围,而不会损失精度.另请参见

I believe this is because jq can only represent legal JSON data and the number you've given is outside the range that can be represented without loss of precision. See also

如果您需要使用更大的数字作为jq中的字符串,则可以尝试使用此库:

If you need to work with larger numbers as strings in jq you may want to try this library:

  • jq-bigint
    用于处理可能带有符号的大整数库任意长的十进制字符串.由Peter Koppstein(@pkoppstein)撰写,并根据MIT许可发布.

这篇关于JQ Transform修改数字吗?我该如何克服?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆