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

Shridhar Hegde 321 Reputation points

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 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,348 questions
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
6,030 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Baker Kong-MSFT 3,761 Reputation points

    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