Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8469685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:17:49+00:00 2026-06-10T16:17:49+00:00

Possible Duplicate: Large numbers erroneously rounded in Javascript I am using jQuery.parseJSON() to take

  • 0

Possible Duplicate:
Large numbers erroneously rounded in Javascript

I am using jQuery.parseJSON() to take a json string and make it an object. The json string is placed in a script tag by our server with the initial markup. The json string contains values that reference different resources on our website.

There’s problem in the implementation of this that was overlooked in development, and is now starting to rear it’s head. Our server is java based. Numeric values are for the most part represented as Longs. So the json string will have things like “…’id’: 25783071737028608…”. This is a problem because this value exceeds the max value for a JS Number type by two whole powers of 10. In this case the number get rounded up: 25783071737028610, which causes all sorts of data inconsistency issues.

This type of pattern is ubiquitous on our website, and the values represent values from our database. I want to avoid doing a massive refactoring of the database. I also want to avoid just passing things to the browser as strings (“…’id’: “25783071737028608”…” because finding every instance of a long being passed to javascript, would require a massive refactor of our database.

Is there anyway to represent a Java long type in JavaScript? If no (which I believe to be the case) is there any creative work arounds that you might have used to resolve similar issues?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T16:17:50+00:00Added an answer on June 10, 2026 at 4:17 pm

    As you already mentioned your values exceed maximum integer value in JavaScript, so there’s nothing you can really do other than passing your values as strings or writing your own JavaScript JSON parser (or modifying jQuery one) and parse long integer values as strings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Deleting Objects in JavaScript I have a JS object having a large
Possible Duplicate: How to avoid scientific notation for large numbers in javascript? Hi All,
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: .NET Integer vs Int16? Which is faster for large numbers of tests
Possible Duplicate: working with incredibly large numbers in .NET I'm working on a simple
Possible Duplicate: Detecting an “invalid date” Date instance in JavaScript I was using the
Possible Duplicate: Subtracting long numbers in javascript Can anyone tell me how to compare
Possible Duplicate: Cache Object in PHP without using serialize So I have built a
Possible Duplicate: JavaScript equivalent to printf/string.format Is there a more C like way to
Possible Duplicate: Working with large numbers in PHP. I run a completely useless Facebook

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.