Error: Cannot create and populate list type Chirpity.User

Apr 13, 2009 at 12:08 AM
Hello,

I am trying to deserialize some Json from twitter, but I just can't get it working.

        Dim Followers As User = New User
        Dim Settings As JsonSerializerSettings = New JsonSerializerSettings()
        Settings.MissingMemberHandling = MissingMemberHandling.Ignore
        Followers = JsonConvert.DeserializeObject(response, GetType(User), Settings)

Two things happening here:
1. I am getting the error in that last line.
2. The Settings.MissingMemberHandling  is stuck on MissingMemberHandling.Error. Setting it to MissingMemberHandling.Ignore does nothing.

I also need to know if I am on the right track here. The JSON in response is actually an array of users and all of the sample code I have found assumes a single instance. Do I do something like, Dim Followers() As User = New User?

Thanks,
Brad

Coordinator
Apr 17, 2009 at 9:40 PM
Followers = JsonConvert.DeserializeObject(response, GetType(List(Of User)), Settings)

?