Ajax Response is enclosed in XML Prolog and String tag which causes Invalid JSON

Ajax Response is enclosed in XML Prolog and String tag which causes Invalid JSON

spssg2003spssg2003 Posts: 4Questions: 3Answers: 1

I am making an AJAX call to a ASP.NET WebMethod. The webmethod is returning a string in the following format:
{"data":[{"MemberNumber":"1","FirstName":"","LastName":"Patterson ","MiddleName":"","NationalityDesc":"","NationalityRefNbr":0,"Gender":null,"BirthDate":null,"MaritialStatus":null,"MaritialStatusRefNbr":0,"IdentityType":null,"IdentityRefNbr":0,"ParticipantType":null},{"MemberNumber":"","FirstName":"","LastName":"Patterson ","MiddleName":"","NationalityDesc":"","NationalityRefNbr":0,"Gender":null,"BirthDate":null,"MaritialStatus":null,"MaritialStatusRefNbr":0,"IdentityType":null,"IdentityRefNbr":0,"ParticipantType":null}]}

However when I check the XHR Response the JSON text array is enclosed in XML Prolog and a String tag:

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">{"data":[[{"MemberNumber":"" etc.....

</string>

I believe the Prolog and string tag is causing the Invalid JSON. Does anyone know how to prevent .NET from adding the prolog?

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.