asp.net web api - .net Web API Json Property attribute not working when serilize using JsonConvert.serilizeObject -
json libarary convert data json
this main method return 2 list 1 property list list , list
public static tuple<list<roomdaybook>, list<string>> daybookrowdata(datetime startdate, datetime enddate, int supplierid, bool wantsubroom) { dataset dsdaybook = filldaybookdata(startdate, enddate, supplierid); ............................ ............................ lstdaybook.add(objdaybook); } return new tuple<list<roomdaybook>, list<string>>(lstdaybook, guests); }
in roomdaybook class in use jsonproperty give jsonproperty name in json serilization in stand of property name
public class roomdaybook { [jsonproperty(propertyname = "rc")] public string roomcode { get; set; } [jsonproperty(propertyname = "rn")] public string roomname { get; set; } [jsonproperty(propertyname = "hs")] public bool hassubroom { get; set; } [jsonproperty(propertyname = "rd")] public list<roomdetail> roomdetails { get; set; } [jsonproperty(propertyname = "srs", nullvaluehandling = nullvaluehandling.ignore)] public list<roomdaybook> subrooms { get; set; } }
it's woking in normal aspx webmethods not working in web api please me find me reason behind
i found problem in different version of newton.json library different between class library , web api project that's not convert in proper format
Comments
Post a Comment