Result: parsererror : SyntaxError: Unexpected token < in JSON at position 0 : 200 :OK

Shri-6058 326 Reputation points
2020-08-21T17:47:36.077+00:00

I have a REST api web service returning xml array. I call via getJSON and display display resulting parse error. is this something need to parse xml to json?

Microsoft 365 and Office SharePoint For business Windows
Microsoft 365 and Office SharePoint Server Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Baker Kong-MSFT 3,801 Reputation points
    2020-08-24T01:51:04.423+00:00

    Hi ShridharHegde-2034,

    As you described, the web service returns XML array, while .getJSON() sends the accept JSON header, it expects a JSON result, it appears you rest API does not support JSON format. So you may need to Use $.get(). the result will be an XML dom and you need to convert it to JSON.

    Best Regards,
    Baker Kong


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.