Skip to content

BigInt field precision loss #800

@unendingblue

Description

@unendingblue

Describe the bug
When querying features that have fields with BigInt values, the JSON response returns them in their numerical form instead of a stringified version.

Even though I wish this was not the case, the JSON specification unfortunately does not cover BigInts, resulting in precision loss (usually the last 2-3 digits) when parsing Tile38's responses.

To Reproduce

SET USER 1 FIELD bigintfield 385189776128479232 POINT 0 0
GET USER 1 WITHFIELDS

Tile38 response (string)

{"ok":true,"object":{"type":"Point","coordinates":[0,0]},"fields":{"bigintfield":385189776128479232}}

JSON parsed (JS object)

{"ok":true,"object":{"type":"Point","coordinates":[0,0]},"fields":{"bigintfield":385189776128479200}}

This behavior is consistent across all GET output formats (OBJECT/POINT/BOUNDS)

Expected behavior
Tile38 should stringify BigInt fields when the OUTPUT mode is set to JSON.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions