0
我想反序列化處理的json數據看到:反序列化
context.Response.ContentType = "application/json";
var data = context.Request;
var sr = new StreamReader(data.InputStream);
var stream = sr.ReadToEnd();
var javaScriptSerializer = new JavaScriptSerializer();
var asd = javaScriptSerializer.Deserialize<objEnt>(stream);
我得到正確的價值觀在流:像
"{\"objEnt\":{\"EventName\":\"uyiouioui\",\"EventId\":0,\"Active\":\"1\",\"CountryId\":5,\"StateId\":7,\"CityId\":6,\"Contact\":\"uio\",\"EventVenue\":\"uio\",\"Address\":\"uio\",\"Status\":true,\"Longitude\":\"89\",\"Latitude\":\"89\",\"ShortDesc\":\"ouioui\",\"EventDesc\":\"ouiouio\",\"EventCategoryId\":7,\"StartDate\":\"6/7/2014\",\"EndDate\":\"2014-06-13T18:30:00.000Z\",\"errors\":[],\"FileName\":\"/NightlifeSite/NightlifeClientuploads/Events/\",\"StartTime\":\"12:00 AM\",\"EndTime\":\"12:00 AM\",\"StateName\":\"Karnatka\",\"CityName\":\"Banglore\",\"CountryName\":\"India\",\"EventCategoryName\":\"sadfaewyu\"}}"
但這個值不在我的'asd'渲染每次計數只有零!
我objEnt類是這樣的:
[Serializable]
public class objEnt
{
public List<EventEntity> obj { get; set; }
}
[Serializable]
public class EventEntity:Base
{
public string EventName { get; set; }
public string FileName { get; set; }
public int EventId { get; set; }
public int CountryId { get; set; }
public int StateId { get; set; }
|
|
|
more
這真是越來越混亂與DTO類
您是否嘗試過使用JSON 。淨?它比提供的默認序列化器好得多。 – Navyseal