3
Answers

Json Serialize / Deserialization

Rick Freeman

Rick Freeman

9y
1.1k
1
Hello,
 
I'm trying to parse this json data, I'm getting this error:
Unexpected character encountered while parsing value: T. Path '', line 0, position 0
 
 string result = service.Response.ToString();
 
The result data is shown in attached file. 
 string deserializeObj = JsonConvert.DeserializeObject(result).ToString(); // error
  
            JObject j = JObject.Parse(deserializeObj);
 
same error if I try: JObject j = JObject.Parse(result);
 

            JArray data = (JArray)j["users"];

            var query = new List<Followers>();

            query = (from item in data

                     select new Followers
                     {

                         screenName = item["screen_name"].ToString().Replace("\"", ""),
                         profileImage = item["profile_image_url"].ToString().Replace("\"", ""),
                   userID = long.Parse(item["id"].ToString().Replace("\"", ""))

                      
                     }).ToList();

            return query;

Attachment: response.zip

Answers (3)