it-tools icon indicating copy to clipboard operation
it-tools copied to clipboard

JSON prettify and format Long number precision is lost

Open yoyo32599 opened this issue 5 months ago • 3 comments

Describe the bug

Image Describe the bug When inputting a large integer (larger than Number.MAX_SAFE_INTEGER) into the JSON prettify tool, the number gets silently truncated or rounded, resulting in loss of precision.

Input:

{
  "userId": 17478252242305210114
}

Expected output:

{
  "userId": 17478252242305210114
}

Actual output (incorrect):

{
  "userId": 17478252242305210000
}

Thank you!

What happened?

A bug happened!

System information

npx envinfo --system --browsers

Where did you encounter the bug?

Public app (it-tools.tech)

yoyo32599 avatar Jul 17 '25 08:07 yoyo32599

yaml format has the sama bug!

zsddyd avatar Jul 18 '25 11:07 zsddyd

Hi @zsddyd and @yoyo32599 , fixed in my fork: https://sharevb-it-tools.vercel.app/yaml-prettify and https://sharevb-it-tools.vercel.app/json-prettify

And if you are interested in an up to date version of it-tools, with many improvements, new tools, and bug fixes, as this repo is almost no more maintained, I made a fork here : https://github.com/sharevb/it-tools (https://sharevb-it-tools.vercel.app/ and docker images https://github.com/sharevb/it-tools/pkgs/container/it-tools)

sharevb avatar Jul 18 '25 16:07 sharevb

Thank you very much!

yoyo32599 avatar Jul 21 '25 01:07 yoyo32599