While quering with the CAML query in the SharePoint REST API throws following error.

    "error": { 
        "code": "-1, Microsoft.Data.OData.ODataException", 
        "message": { 
            "lang": "en-US", 
            "value": "Invalid JSON. A comma character ',' was expected in scope 'Object'. Every two elements in an array and properties of an object must be separated by commas." 

Request: ../sites/POCs/_api/web/lists/getByTitle('TestList2')/GetItems(query=@v1)?@v1={'ViewXml':'2'} Request Headers and request

1 Answer 1


The issue was the CAML which is passing in the GetItems query. Simply you can replace single quote with double quote, further means that in CAML is XML based query language and you need to provide attributes within the double quotes.

Request CAML Sould be as follows;

../sites/POCs/_api/web/lists/getByTitle('TestList2')/GetItems(query=@v1)?@v1={'ViewXml':'<View><Query><Where><Eq><FieldRef Name=***"ID"***></FieldRef><Value Type=***"Number"***>2</Value></Eq></Where></Query></View>'} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.