When we use REST we get output as xml how do we parse this via JSOM and fetch the values?

Also, please provide some information on how to use this in SSOM instead of JSOM?

  • Are you asking how to make a REST call using JSOM? – wjervis Jul 16 '14 at 12:52
  • I am asking 2 things: 1. when making REST call via JSOM and 2. when making REST calls via SSOM, how do we make use of the result returned? – variable Jul 17 '14 at 4:34

The default format for SharePoint REST endpoint is application/atom+xml. Instead of manipulating results returned in Xml format you could specify JSON format.

Use accept header to specify the format for response data from the server. To get the results in JSON format, include an Accept header set to application/json;odata=verbose.


The code in the following example shows you how to request a JSON representation of all of the lists in a site by using


        url: siteUrl + "/_api/web/lists",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
        error: function (data) {


var request = (HttpWebRequest)HttpWebRequest.Create(siteUrl + "/_api/web/lists");
request.Method = "GET";
request.Accept = "application/json;odata=verbose";
request.Headers.Add("Authorization", "Bearer " + accessToken);
var response = (HttpWebResponse)request.GetResponse();
  • HI Vadim, I want to know the way in which we can access the result in c# and in javascript. You answer is related to c#. But suppose we use REST in javascript. Then how to parse result? – variable Jul 23 '14 at 6:22
  • In JavaScript environment it returns JSON object. Since JSON is a subset of JavaScript, it can be used in the language with no muss or fuss. See the JavaScript example in the answer, for example, to retrieve the first list title: var title = data.d.results[0].Title: – Vadim Gremyachev Jul 23 '14 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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