ASP.NET解析POST过来的JSON串
public void InsertUser(HttpContext context, String id)
{
User model = new User();
using (var reader = new System.IO.StreamReader(context.Request.InputStream))
{
String xmlData = reader.ReadToEnd();
if (!string.IsNullOrEmpty(xmlData))
{
//业务处理
model = JsonConvert.DeserializeObject<User>(xmlData);
}
}
}
public class User
{
public string RealName { get; set; }
public string Province { get; set; }
public string City { get; set; }
public string Hospital { get; set; }
public string Department { get; set; }
public string TagID { get; set; }
public string Mobile { get; set; }
}
POST Man传JSON如图
仅供学习参考,如有侵权联系我删除