I have Webservice SOAP method which takes Json as input argument.
//For sample
string jsonString = "[{"Year":"2020","UserId":"1","Comp":"20","DeptId":"32","CategoryId":"53","ItemId":"0"}]";
string[] processString = budget.BudgetTagNet(jsonString);
Now "budget.BudgetTagNet(jsonString)" returns Array of string as mentioned and the SOAP Response shows following value: SOAP RESPONSE RESULT
Now I want to convert the returned budget array to DataTable for further utilization for my project but I am unable to do. What could be the best way to achieve that. What I have tried so is mentioned below.
string jsonString = CommonEnum.DataTableToJSON(Table);
err.Message = "Json String is : " + jsonString;
err.Insert();
string[] processString = budget.BudgetTagNet(jsonString);
err.Message = "Budget service data is : " + processString[1];
err.Insert();
var XMLAsString = CommonEnum.SerializeXML(processString[1]);
err.Message = "Converted XML To String data is : " +
JsonConvert.SerializeObject(XMLAsString);
err.Insert();
dt = (DataTable) JsonConvert.DeserializeObject(XMLAsString, (typeof(DataTable)));
err.Message = "DataTable data : " + JsonConvert.SerializeObject(dt);
err.Insert();
And finally Data inserted in database as for the above method is: Database values inserted
You can use Regex to parse data :