Getting error message - JsonData instance doesn't hold a string


#1

Working with Twitter with ASP.NET and linq to twitter so i can embed tweets. However now all of a sudden embeds are not working - getting JsonData instance doesn’t hold a string
even created a new twitter application with new keys and secrets - still get this error. Google has not revealed any cause of the error. Thanks for any help.


#2

This occurred because of an undocumented change in the Twitter API. More specifically, the return value of statuses/oembed (https://dev.twitter.com/docs/api/1.1/get/statuses/oembed) contained a cache_age property of type string. You can see in the Twitter API documentation that it’s still documented as a string, and it was a string until you began seeing that error. Around that time, cache_age became a number and is still a number. I changed LINQ to Twitter to handle the value as a ulong, which corrects the problem. The fix is available via source code download at http://bit.ly/18zCywZ and will be included in the next release of LINQ to Twitter.


#3

Hey Joe,

Thanks for pointing this out. Will it break your library if we switched it back to a string as we originally documented it? (Yet still representing a Long value?)


#4

Yes, I just tested. It would break. Since C# is strongly typed, any changes in field type cause problems. I think the same situation might affect other strongly typed languages, like Java and C++, too.

I think that representing the property as a long, rather than a string, was the correct design. Whichever way you go, a little heads-up on any changes would be helpful.

Thanks


#5

I think you’ll find I over-corrected here and that we should be back to a String for consistency with the original documentation’s sake. Sorry for the shuffle.


#6

I am getting an error like json data does not hold an integer.this error is only for newly created twitter accounts.please help me to resolve this issue