Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!