Bug Tracker

Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#5796 closed bug (wontfix)

Large Numbers in JSON Data get Truncated by $.getJSON

Reported by: qurban1970 Owned by:
Priority: low Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: json, jsonp, cross-domain, truncate, numbers Cc:
Blocked by: Blocking:

Description

When json data contains large numbers (eg: 413000000000000166743) as values in a key:value pair, they get truncated when returned by $.getJSON. This appears to be an intrinsic javascript problem for very large numbers. If I could stipulate in the function call that all data should be treated as text, then that should dodge the problem. And if I need a value to be a number, then javascript internal type-casting or the Number() function should be enough. For what it's worth, I encountered this when working with Zoho Creator ID values.

Change History (2)

comment:1 Changed 9 years ago by curiousdannii

To treat it as text would mean it would be invalidly formatted JSON.

What do native JSON parsers do with big numbers?

comment:2 Changed 9 years ago by SlexAxton

Priority: majorlow
Resolution: wontfix
Status: newclosed

This is a limitation of javascript, not jQuery. You can validly store numbers as strings, and convert them later.

Note: See TracTickets for help on using tickets.