Data type for metrics in JSON object

analytics
stats

#1

What is the correct data type for each metric in JSON object?

I trying to parse conversion_purchases sale_amount as Java Int and it fails due to number out of range of int. This will require us to use Java Long for parsing sale_amount.

Are there any other metrics that exceeds max value of Java Int?

Thanks.


#2

The most common gotcha is with the ID string possibly being returned as 64-bit, please see this document which clarifies about that: https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake

For each response endpoint we generally return micros for anything that could contain a currency (like USD or JPY), number format for anything that would fit in Double or Int-32 and 64-bit should follow same rules as the above document. Each endpoint is independent so you may find cases where it doesn’t make sense to you, feel free to send us feedback in these cases.

Will also take this as feedback as we improve documentation moving forward.

Thanks,

John