asp.net - How to convert Json in C#? -
i using c#.net asp.net mvc. have following code
var lstrelations = _people.getallusers(); list<string> lstemailaddresses = lstrelations.select(p =>p.emailid).tolist<string>(); return json(lstemailaddresses, jsonrequestbehavior.allowget);
this generating output like
["xxy@xct.com", "text13@tds.com", "sdxxa@xys.com"]
but want generate json
["emailid:xxy@xct.com", "emailid:text13@tds.com", "emailid:sdxxa@xys.com"]
i want put name of each address "emailid"
try code...
var lstrelations = _people.getallusers(); var lstemailaddresses = lstrelations.select(p => new { emailid = p.emailid }).tolist(); json(lstemailaddresses, jsonrequestbehavior.allowget);
Comments
Post a Comment