Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

141
Vistas
Serialization of numerical values in JSON

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!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

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())

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda