asp.net - WebMethod return values in JSON format -


How do I return the client back in the JSON format from Webmethod?

There are two stable int values ​​that I want to return. Do I need to create a new object with those 2 properties and return it? The GetStatus () method is often called and I do not like the idea of ​​creating special objects for Jason formatting every time ...

[WebMethod] public static trusts () { Int statusProcess, statusProcessTotal; Status.Lock.EnterReadLock (); StatusProcess = Status.Process; // static field operation process = total status Processing total; // Static Field Status. Lock. Exterior lock (); Returns ...}

I capture the return value on the client side:

  protected on the function (results, user context, filename) (Pageithm. GateStats (I go with an object;);  

What do you do with this Fits with the requirement If you have two return values, then you have to put them together structured.

  StatusResult of public class {public A complete completion process; Receive the public status GetStatus () {int, the process operation, the total of operation process; //Status.Lock.EnterReadLock (); The procedure procedure = 5; The status process = total; 1; // Static field var result = New status result (result); result.progress process = status process; result. = Status process total; return result;}  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -