c# - Cannot deserialize the current JSON array into List<> 'because the type requires a JSON object " -
i getting
"cannot deserialize current json array (e.g. [1,2,3]) type 'mercury.tgc.service.dto.contactresponsedto' because type requires json object (e.g. {"name":"value"}) deserialize correctly."
what doing wrong?
json returned api
{ "status": "success", "body": { "companyname": "keep org merge test", "taxid": "tax id2", "addresses": [ { "id": 100, "addressname": "location 1", "address1": "1234 create ave", "address2": "suite 1234", "city": "west des moines", "state": "ia", "postalcode": "50266", "country": "usa", "latitude": 41.575011, "longitude": 93.709212, "isprimary": true, "imageshortkey": "5a0lc9ge5n", "types": [], "phones": [] } ], "phones": [ { "id": 122, "phonenumber": "515-924-2452", "phonetype": "work", "isprimary": true, "extension": null }, { "id": 123, "phonenumber": "515-326-1919", "phonetype": "work", "isprimary": false, "extension": null } ], "id": 5100, "searchoptout": false, "tradecodes": [], "doingbusinessas": [], "leedlevel": 3, "hasbimexperience": true, "facebookurl": null, "twitterhandle": null, "yearfounded": "1924", "profiletext": null, "mainemail": null, "websiteurl": null, "logourl": null, "currentemr": 1.2 }, "messages": null }
c# code:
class restfulresponsecontactdto { public string status { get; set; } public contactresponsedto body { get; set; } public list<string> messages { get; set; } } public class contactresponsedto { public list<contact> contacts { get; set; } } public class contact { public string id { get; set; } public string orgid { get; set; } public string firstname { get;set; } public string lastname { get;set; } public string email { get;set; } public string title { get;set; } // public list<addresses> addresses { get; set; } //public list<phones> phones { get; set; } //public list<string> messages { get; set; } //public string requeststatus { get;set; } }
Comments
Post a Comment