RHO
RHO

Reputation: 51

Working in frontend JS. Is there a clean way to prevent all request response large integers from being rounded

I'm returning a dictionary object to a web route. And annoyingly, my frontend JS is automatically rounding all the integer values in the response.json()

let currentUserId;
let path = "/account?raw=True";
fetch(path)
.then(response => response.json())
.then(data => {
if (BigInt(data.id) != null) {

This means that data.id is being rounded and I need this value to remain as its exact form. Is there a clean method for ensuring values aren't rounded, aside from doing data.id = BigInt(data.id) on every single ID or large integer value.

Upvotes: 0

Views: 36

Answers (0)

Related Questions