1
我使用WebApi和Client開發服務,通過POST方法向此服務發送gzip壓縮數據(以節省帶寬)。他們都在我的控制之下。在服務器我收到的壓縮數據,解壓縮,並有字符串,如:ASP.NET WebApi表單 - urlencoded字符串反序列化
section[0][caption]=Foo&
section[0][address]=175896&
section[0][counters][]=2&
section[0][counters][]=2&
section[0][errors][]=ERR_NOT_AVAILABLE&
errors=true&
trmtimestamp=1346931864358
即簡單的WWW的形式進行了urlencoded字符串。
是否ASP.NET MVC4 WebApi有一些方法來綁定或反序列化這個字符串到我的模型?
public class Snapshot
{
public List<SectionState> sections { get; set; }
public bool errors { get; set; }
public double date { get; set; }
public double trmtimestamp { get; set; }
}
'SectionState'是某種鍵/值對嗎? – Chris
@Chris不,它是簡單的類'{字符串標題,int地址,int []計數器,字符串[]錯誤}' –