javascript - Change code for Console output to JSON output -


i have code read qaaws , prints out console, want instead create javascript run same code save json can used website. tried debug.writeline() instead of console.writeline() has not worked.

i have writen code before read xml , convert json somehow giving me more issue. here code read in console:

using system; using system.collections.generic; using system.linq; using system.text; using consoleapp1.testweb;  namespace consoleapp1 {     class program {         static void main(string[] args) {             consoleapp1.testweb.qaaws_by_user test1 = new             consoleapp1.testweb.qaaws_by_user();             string message, creatorname, creationdateformatted, description, universe;             datetime creationdate;             int queryruntime, fetchedrows;             consoleapp1.testweb.row[] row = test1.runqueryasaservice("<username>", "<password>", out message, out creatorname, out creationdate, out creationdateformatted, out description, out universe, out queryruntime, out fetchedrows);             int resultcount = row.length;             (int = 0; < resultcount; i++) {                 console.writeline(row[i].user + " " + row[i].owed);             }             console.read();         }     } } 

let me know if there other information need.

we used qaaws @ work, here approach can use. instead of using console application better create asmx web service. service contain class return arraylist , asmx file take list , return json. here how look

testwebservice.asmx.cs

using system; using system.collections; using system.collections.generic; using system.linq; using system.web; using system.web.services; using newtonsoft.json;  namespace testwebservice {     /// <summary>     /// summary description testservice     /// </summary>     [webservice(namespace = "http://tempuri.org/")]     [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)]     [system.componentmodel.toolboxitem(false)]     // allow web service called script, using asp.net ajax, uncomment following line.      // [system.web.script.services.scriptservice]     public class testservice : system.web.services.webservice {          private loadservice user;          public testservice() {             this.user = new loadservice();         }          [webmethod]         public string testresult() {             arraylist list = this.user.gettestuser();              return jsonconvert.serializeobject(list);         }     } } 

and here testwebservice.cs

using system; using system.collections; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.diagnostics; using newtonsoft.json;  namespace testwebservice {     public class loadservice {         public arraylist gettestuser() {             testwebservice.testweb.qaaws_by_user test1 = new             testwebservice.testweb.qaaws_by_user();             string message, creatorname, creationdateformatted, description, universe;             datetime creationdate;             int queryruntime, fetchedrows;             testwebservice.testweb.row[] row = test1.runqueryasaservice(("<username>", "<password>", out message, out creatorname, out creationdate, out creationdateformatted, out description, out universe, out queryruntime, out fetchedrows);             int resultcount = row.length;             var index = 0;             var list = new arraylist();             (int = 0; < resultcount; i++) {                 getuserinformation userinformation = new getuserinformation {                     user_name = row[i].user,                     owed_value = row[i].owed                 };                 list.add(userinformation);                 index++;             }             return list;         }     }     public class getuserinformation {         public string user_name { get; set; }         public double owed_value { get; set; }     } } 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -