Deserialize Object from json string to object


#1

using the url below i am trying to pull the followers that a particular screen name has which is working fine. when i try deserialize the code into a ojbect i get the error message below any ideas why this would be. I have also put the code for the for the Json type

URL = "https://api.twitter.com/1.1/followers/list.json?&screen_name="will insert here "

Deserialize into objec code

var result = JsonConvert.DeserializeObject<List>(FollowerData)

Json type code

public class Follower
    {
       

        [JsonProperty("created_at")]
        public string CreatedAt { get; set; }

		[JsonProperty("id")]
		public string Id { get; set; }

		[JsonProperty("id_str")]
		public string IdStr { get; set; }

        [JsonProperty("name")]
        public string Name { get; set; }

        [JsonProperty("screen_name")]
        public string ScreenName { get; set; }

        [JsonProperty("location")]
        public bool Location { get; set; }

        [JsonProperty("description")]
        public string Description { get; set; }

    }

Error Message
{“Cannot deserialize the current JSON object (e.g. {“name”:“value”}) into type ‘System.Collections.Generic.List`1[OAuthTwitterWrapper.JsonTypes.FollowerUsers]’ because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.\r\nPath ‘users’, line 1, position 9.”}


#2

The response you get from this method is a “cursored collection” and contains metadata about the collection. You’ll need to traverse the hash structure to get to the array of users. You may also find it better to work with the combination of followers/ids and users/lookup instead of the limited-use followers/list method.