0
{
"access_token": "fooToken",
"token_type": "fooTokenType",
"expires_in": fooExpres,
"refresh_token": "fooRefresj",
"created_at": forCreatedTime,
"user_id": fooUserID,
}
當我向它發送一個post請求時,我的web服務返回上面的JSON,我可以讓我的程序以原始未格式化的格式將JSON寫入終端。但我不確定反序列化最簡單的方法是什麼。使用restsharp反序列化JSON的最簡單方法是什麼?
IRestResponse response = client.Execute(request);
我使用上述實際執行的請求,並從我迄今收集的,我需要把上面一行...
IRestResponse response = client.Execute<fooClass>(request);
,然後創建像fooClass這個?
public class fooClass
{
public string access_token { get; set; }
public string token_type { get; set; }
public int expires_in { get; set; }
public string refresh_token { get; set; }
public int created_at { get; set; }
public int user_id { get; set; }
}
但是我對什麼額外的代碼片段我只是需要得到一個基本的程序,可以說寫或的access_token任何控制檯不確定? 對不起,這是我第一次玩accessors和restSharp。
感謝