serialize json result to ITweetList

Jun 18, 2014 at 11:48 AM
Is there an easy way to convert a json result from the function
SearchJson.SearchTweets(searchParameter);
to an object such as ITweetList?
I know I can instantly get back such an object by using
Search.SearchTweets(searchParameter); 
but I do not want to execute the search twice.
Coordinator
Jun 18, 2014 at 12:53 PM
Hi,

I am not sure I will implement this feature but feel free to use the following code:
var json = SearchJson.SearchTweets("MY_SEARCH");
var searchQueryHelper = TweetinviContainer.Resolve<ISearchQueryHelper>();
var tweetDTOs = searchQueryHelper.GetTweetsFromJsonResponse(json);
var tweets = Tweet.TweetFactory.GenerateTweetsFromDTO(tweetDTOs);
Feel free to let me know if you think this should be a builtin-feature. I am planning to do the opposite.
Objects -> Json

Linvi
Marked as answer by karamazovi on 6/18/2014 at 6:59 AM
Jun 18, 2014 at 1:59 PM
Thanks for your solution, it worked for me! It could be a nice feature if there is a demand for it.
I found the documentation not to be sufficient to come up with this solution (speaking on my behalf).
Coordinator
Jun 18, 2014 at 2:14 PM
Hi,

I found the documentation not to be sufficient to come up with this solution (speaking on my behalf).

This is not some code that I expect from any developer using the API. When I use (TweetinviContainer.Resolve) it means that this is not a feature provided to the developer. The reason is that there are so much feature in Tweetinvi that developers would be lost if they all were easily accessible.

If there is any feature (not implemented) that you need, feel free to ask here, and I will be happy to help you ;)

Linvi