Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Twitter user ID is too large for JS serialization to be a long number #95

Open
vminkov opened this issue Mar 1, 2016 · 1 comment
Open

Comments

@vminkov
Copy link

vminkov commented Mar 1, 2016

Hey guys,

First, thanks for the awesome twitter integration package, it's been of great value!
I don't why you decided to use the Twitter user ID as a long number rather than store it in a String. I know it takes less space but if you are not going to make math operations with it and the ID comes from a third party service - then it does make sense to me to wrap the ID in a String, not a Long (and even if you want to compare it to other ID values, string might do it as well).

The problem is - the user ID for my handle @veliko_test1 is 701711162086449152 which is a valid long number in Java, but when returned as JSON to the frontend, the value is approximated by the JS JSON parser to a different value.

To reproduce, just open up a JS parser, preferably the browser console and type:

var number = 701711162086449152;
number

If it makes sense, can you please use String objects for the Twitter user ID instead of longs?

Thanks!

P.S. If you think it's more appropriate for me to make a pull request with the fix, I would happily do so.

@kmohanarangam
Copy link
Contributor

I'm having the same issue. Did you create a pull request with fix already?

kmohanarangam added a commit to kmohanarangam/spring-social-twitter that referenced this issue Jul 3, 2017
…rialization

	Twitter provides id and id_str in User Object. Id is of datatype
	long and that could get too long for some programming languages
	to handle. For such languages, API is modified to return id in
	String format using the method getIdStr().
habuma added a commit that referenced this issue Oct 24, 2017
Fix for Issue #95 - Twitter userId is too large for JS serialization
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants