handling infinity values in JSON

后端 未结 1 1353
慢半拍i
慢半拍i 2021-01-27 13:10

I need at one place to have the support for infinity, -infinity and NaN values in my JSON. Now though JSON does have support for these values, but is there any support for speci

相关标签:
1条回答
  • 2021-01-27 14:05

    JSON does not support neither infinity or NaN values (and never has, since the original json.org grammar). Neither does JSON Schema (because it is only defined for RFC8259-compliant JSON documents or structures).

    This is due to interoperability reasons - otherwise each target language that does not support infinities or NaNs would need to always wrap these values.

    Whether some validator accepts invalid json documents - does not really matter. They are still invalid.

    0 讨论(0)
提交回复
热议问题