Jeff Heaton

Long ID's in Javascript

Discussion created by Jeff Heaton on Jul 5, 2018
Latest reply on Jul 13, 2018 by Robert Carroll

What is the suggested way to deal with the very long ID's that Canvas creates in JavaScript?  For example, if I try to parse this response (from a list of courses), Javascript rounds the ID up to 60780000000000040, rather than the expected 60780000000000037. 

 

const str = '[{"id":60780000000000037,"name":"This is a test","account_id":60780000000000198}]'
console.log(JSON.parse(str)[0].id)

Outcomes