Different id and id_str in the same tweet


#1

Hi,

I’m trying to navigate a search and I was using the id_str param (being lazy ;)) as I thought it should be the same as id but in string. However I realized in the search all tweets have different id and id_str… Even more… if I query with sinceId using the since_id_str I get the the same (but different between them) since_id, since_id_str than I had in that tweet… but if I query using the regular since_id I get equal since_id and since_id_str.

I write the example here better:
Query (something with many results):

http://search.twitter.com/search.json?q="movistar"

Result:
{
created_at: “Fri, 28 Sep 2012 09:27:48 +0000”,
— SAME —
from_user_id: 116394465,
from_user_id_str: “116394465”,
— DIFFERENT —
id: 251614174118023170,
id_str: “251614174118023168”,
— SAME —
to_user_id: 44992826,
to_user_id_str: “44992826”,
}

And if I query with sinceId = since_id_str , I get:
Query:
http://search.twitter.com/search.json?since_id=251613247088754688&q="movistar"

Result:
since_id: 251613247088754700,
since_id_str: “251613247088754688”

And… if I query with sinceId = since_id, I get
Query:
http://search.twitter.com/search.json?since_id=251613247088754700&q="movistar"

Result
since_id: 251613247088754700,
since_id_str: “251613247088754700”

Is it a bug or am I doing something wrong? Meanwhile I will use simply id or since_id but I think this should be the same than its _str versions.


#2

You’ll find this to be an observational error in that if you use an environment that in any way tries to consume the JSON, it munges very large integers. See the FAQ question below for more information:

[faq:5818]