Reputation: 2625
I was looking at Openload.co API and I've seen that in the json response some numeric values are represented as integers while others as string, for example in this response:
{
"status": 200,
"msg": "OK",
"result": {
"extid": "extuserid",
"email": "[email protected]",
"signup_at": "2015-01-09 23:59:54",
"storage_left": -1,
"storage_used": "32922117680",
"traffic": {
"left": -1,
"used_24h": 0
},
"balance": 0
}
}
storage_used is a strings and balance is integer. Since they are both numeric values and can't be strings in any case, is there some particular reason to set storage_used as string?
Upvotes: 2
Views: 165
Reputation: 1565
I think this answer is interesting to you: https://stackoverflow.com/a/25822886/1406798
Javascript represents its numbers as double precision floats which limits the largest integer number that can be represented to +-9007199254740992.
So if your number can be higher/lower than this value you need to transfer them as strings.
Upvotes: 2