RestSharp not deserializing JSON Object List, always Null

Based on the @agarcian’s suggestion above, I googled the error:

restsharp Data at the root level is invalid. Line 1, position 1.

and found this forum: http://groups.google.com/group/restsharp/browse_thread/thread/ff28ddd9cd3dde4b

Basically, I was wrong to assume that client.Execute was going to be able to auto-detect the return content type. It needs to be explicity set:

var request = new RestRequest(Method.GET);
request.OnBeforeDeserialization = resp => { resp.ContentType = "application/json"; };

This could be cited more clearly in RestSharp’s documentation. Hopefully this will help someone else out!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)