Sorting order of user_mentions field in twitter_entities


#1

Hi all,

For a tweet like this:
Hey @user3, blah blah blah @user1. blah blah @user2 blah blah blah
as you can see, the order of mentions of users in this tweet is user3 ,user1 and lastly user2.
my question is, does twitter GUARANTEES that any response payload from any twitter REST endpoint v1.1 will preserve this order for user_mentions attribute?
https://dev.twitter.com/overview/api/entities-in-twitter-objects#user_mentions
thanks


#2

If you’re really concerned about it, your best bet is to compare the indices.


#3

The Twitter public API makes no guarantees related to response formats. You should not build assumptions depending on order in your code (or otherwise code defensively based on missing or unordered fields).