Json Deserialization


I am currently writing a module to send GET and POST requests for searching for hashtags, user timelines and mentions to drop into a existing application I have.

The reason for this work is that previously I used the TwitterVB dll which isn’t being upgraded to API 1.1, however I want to ensure I have no dependencies on third party software so would rather write my own dll then use open source software.

Can anyone advise what I need to do to convert the Json to a collection of tweet objects for example.

So far I have created .net classes using a free tool online.

I use the below call to deserialize the json to the given class, this works some of the time, however falls over on deserialize call every now and then on
"Cannot convert null to a value type."

Dim result As SearchResults = ParseSearchResults(responseData)

Shared Function ParseSearchResults(ByVal jsonString As String) As SearchResults
Dim s As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim obj As Object = s.DeserializeObject(jsonString)

    Dim dsd As SearchResults
    dsd = s.Deserialize(Of SearchResults)(jsonString)
    Return dsd
End Function

How have people successfully converted the Json to usable class collections?

Any help much appreciated, in the mean time I will continue researching.


Matt (GSXRGoodsell)