Skip to main content

Bug Tracker

Side navigation

#5796 closed bug (wontfix)

Opened January 13, 2010 07:00PM UTC

Closed October 23, 2010 11:42PM UTC

Last modified March 15, 2012 10:31AM UTC

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:

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.

Attachments (0)
Change History (2)

Changed September 01, 2010 04:13PM UTC by curiousdannii comment:1

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

What do native JSON parsers do with big numbers?

Changed October 23, 2010 11:42PM UTC by SlexAxton comment:2

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.