I noticed that https://jwt.io/ outputs the same Base64 string for payloads that contain numerical values written in different notations. For example, these two payloads result in the same Base64 string:
{
"value": 0.000001
}
{
"value": 1.0e-6
}
Both produce: eyJ2YWx1ZSI6MC4wMDAwMDF9
Which after decoding displays as: {"value":0.000001}
Where can I find more information about this? I guess there is a specification for this in the form of RFC or something similar. Informal resources on a related subject are also appreciated!
It doesn't matter how you have created a number. I mean which notation has been used for number literal. The internal representation is IEEE 754. When the serialization happens both values are the same. So the same serialization output is expected.
As of the way number is serialized to a string you can read the Spec. TLDR it depends on the number of significant digits
console.log(1e-6 === .000001)
console.log(JSON.stringify(1e-6), 1e-6.toString())
console.log(JSON.stringify(1e-7), 1e-7.toString())