Skip to content

$string() does not preserve full precision for large numeric values (≥ 15–16 digits) #761

@MaxPlamadeala-RecoLabs

Description

@MaxPlamadeala-RecoLabs

We've been having an issue with jsonata parsing of large numbers. We had this initial json (obfuscated):

"data": [
      {
        ...
        "userId": 5890840712243077,
        "createdAt": "2025-10-30T13:02:59Z",
        "modifiedAt": "2025-10-30T13:02:59Z",
      }
]

And this Jsonata expression:

$string(data[0].userId)

What it gives us is "5890840712243080" which is incorrect as you see. If I try however a smaller number like 589084071224307 (-1 digit) it works perfectly. If I try a larger nr like 589084071224307838838 it goes crazy:
Image
As I see in src/functions.js you have this line, which cuts every number to 15 digits. Is it on purpose? Can this be fixed or do you have an analogy to propose for larger numbers?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions