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?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,621 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,573 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Baker Kong-MSFT 3,791 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