【发布时间】:2012-09-07 05:09:31
【问题描述】:
我使用 WebApi 和客户端开发服务,通过 POST 方法向该服务发送压缩数据(以节省带宽)。他们两个都在我的控制之下。在服务器上我收到压缩数据,解压缩它并有字符串,例如:
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-form-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 不,这是简单的课程
{ string caption, int address, int[] counters, string[] errors }
标签: asp.net-mvc-4 asp.net-web-api