Wrote a webmethod in ASMX to return JSON data to Angular application. So here is how the Webmethod looks like
[WebMethod]
[ScriptMethod(UseHttpGet =true,ResponseFormat =ResponseFormat.Json)]
public MyProjects getReport(int reportId)
{
}
Here is how I'm calling it from Angular
this.client.get('http://localhost:51071/webservice1.asmx/getReport?reportId=596',
{ withCredentials: true, responseType: 'text' })
.subscribe( (data) => console.log(data));
But the problem is the data received at angular app is in XML format. Thats the reason I specified text there. If I specify json there it will ofcourse trigger error saying invalid json data.
I have absolutely no idea what I did wrong or what to change to get pure JSON
Here is how the console output looks like
<?xml version="1.0" encoding="utf-8"?>
<Projects xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<Success>true</Success>
<TotalRecords>391</TotalRecords>
<Data>
<ProjectData>
<ProjectCode>E6012</ProjectCode>