It's amazing how to deserialize the following line in C #:
"[{\"access_token\":\"thisistheaccesstoken\"}]"
I know how to do this if json was:
"{array=[{\"access_token\":\"thisistheaccesstoken\"}]}"
I would do it like this:
public class AccessToken
{
public string access_token {get;set;}
public DateTime expires { get; set; }
}
public class TokenReturn
{
public List<AccessToken> tokens { get; set; }
}
JavaScriptSerializer ser = new JavaScriptSerializer();
TokenReturn result = ser.Deserialize<TokenReturn>(responseFromServer);
But without this array name, I'm not sure. Any suggestions?
Thank!
source
share