您不应该手动序列化返回值。ASP.NET将为您做到这一点。尝试这样的事情:
[WebMethod]public static Person GetPersonInfo(string pFirstName, string pLastName){ // Assuming you have a server-side Person class. Person p = new Person(); p.FirstName = "Pseudo" + pFirstName; p.LastName = "Tally-" + pLastName; p.Address = "5035 Macleay Rd SE"; p.City = "Salem"; p.State = "Oregon"; p.ZipCode = "97317"; // ASP.NET will automatically JSON serialize this, if you call it with // the correct client-side form (which you appear to be doing). return p;}如果您需要返回更动态的内容(例如您的示例似乎正在做的事情),则可以使用匿名类型:
[WebMethod]public static object GetPersonInfo(string pFirstName, string pLastName){ // ASP.NET will automatically JSON serialize this as well. return new { FirstName = "Pseudo" + pFirstName, LastName = "Tally-" + pLastName, Address = "5035 Macleay Rd SE", City = "Salem", State = "Oregon", ZipCode = "97317" }}


