JSON integers: limit on size

前端 未结 3 1895
渐次进展
渐次进展 2020-11-27 16:02

Is it specified anywhere how big JSON integers can be? I\'m guessing that they\'re limited to normal (32 bit) ints, but I can\'t find anywhere that that\'s written down. I n

3条回答
  •  自闭症患者
    2020-11-27 16:31

    RFC 7159: The JavaScript Object Notation (JSON) Data Interchange Format

    This specification allows implementations to set limits on the range and precision of numbers accepted. Since software that implements IEEE 754-2008 binary64 (double precision) numbers [IEEE754] is generally available and widely used, good interoperability can be achieved by implementations that expect no more precision or range than these provide, in the sense that implementations will approximate JSON numbers within the expected precision. A JSON number such as 1E400 or 3.141592653589793238462643383279 may indicate potential interoperability problems, since it suggests that the software that created it expects receiving software to have greater capabilities for numeric magnitude and precision than is widely available.

提交回复
热议问题