c# - How to return JSON from webservice -
In the morning,
I need to return a message from my web service below to one of my code Sample, and I'm returning a string.
[Web method] Public string checkfidSubmission () {string responseText = ""; Try {// stuff goes here feedback text = "it worked!" } Hold (exception before) {responseText = "Apps have filed an error! Exception Message:" + Formerly. message; } Return reaction lesson; } I currently get the following response ...
string xmlns = "http://tempuri.org/" /> I would like to return something like this
{"success": true, "message": "*** message here ***" } I am sure once I get this information, I will be able to return the other items when I need it.
All help is highly appreciated, thanks in advance :)
UPDATE: Just found it ...
return "{message: 'hello World '} " Do I need something
responseText =" {"success": true, "message": \ "an error has occurred : "+ Ex.message +" \ "}"
: [WebMethod] [ScriptMethod (Response format = Response format. Jason)] // Return return format. Public string CheckFeedSubmission () {string responseText = ""; Try {// stuff goes here feedback text = "it worked!" } Hold (exception before) {responseText = "Apps have filed an error! Exception Message:" + Formerly. message; } Return reaction lesson; } The result will be returned: & lt; String xmlns = "http://tempuri.org/" /> {"Success": True, "Message": "*** Message Here ***"} & lt; / String & gt;
Comments
Post a Comment