Large Integers Corrupted by the JSONRenderer #9547
Replies: 3 comments 4 replies
-
Can you tell me how I can reproduce the issue? |
Beta Was this translation helpful? Give feedback.
-
I would suggest looking further to confirm this. |
Beta Was this translation helpful? Give feedback.
-
I just tried to replicate this issue, just made slight changes. path("server/<int:pk>/", ServerView.as_view()), But after this changes, I have tried for I would require more insights on how you have coded this app. |
Beta Was this translation helpful? Give feedback.
-
I store Discord server ID's as primary keys for an object in my database, which is either Sqlite or Postgresql depending on my environment being production or development.
Storing and retrieving these integers is trivial and works without issue, including when fetching them through the DRF API web interface, however the JSON interface for retrieving data corrupts these integers.
Visual Representation (the primary key field is "id"):
In the second image, the primary key ("id") has been corrupted, so that the last 2 digits are rounded down to
00
.I was able to overcome this issue with a custom JSON renderer, that casts large integers to strings, however this issue should probably be addressed within DRF itself.
As for the root of the issue, I strongly believe it's related to the json standard library in python, although I haven't looked further to confirm this.Beta Was this translation helpful? Give feedback.
All reactions