How to get Json object. i'm getting error as "SyntaxError: Unexpected token o"
following are my webapi and resource request.
webapi gives back like this
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
[{"wafId":"1","engagementProjectName":"EngagementProjectName","engagementLibraryStatus":"EngagementLibraryStatus","totalCount":"23"},{"wafId":"1","engagementProjectName":"EngagementProjectName","engagementLibraryStatus":"EngagementLibraryStatus","totalCount":"23"},{"wafId":"1","engagementProjectName":"EngagementProjectName","engagementLibraryStatus":"EngagementLibraryStatus","totalCount":"23"}]
</string>
client code
factory.getSampleData = function () {
var sampleDataCollection = $resource("/api/data/GetSampleData/");
var collections = sampleDataCollection.get();
collections.$promise.then(
function onSuccess(data) {
var d = JSON.parse(data); // getting error as SyntaxError: Unexpected token o
},
function onfailed(reason) {
alert("onfailed : " + reason);
console.log(reason);
}
);
}