Serialize list items from lists.asmx

Web service list.asmx is deprecated, but somehow it seems to be the only way to obtain the desired results. For example, I am not aware of any other way to expand recurrence from an event list using client side code. So, in case you are required to use it, here is how you can obtain an array of objects from XML sent back by the web service.

function parseResponse(xmlResponse) {
    /// <summary>Obtain an array of objects from server responseXML</summary>
    /// <param name="xmlResponse"></param>
    /// <returns type="Array"></returns>

    var items = new Array();
    var rows = (typeof (xmlResponse.getElementsByTagNameNS) === 'undefined') ? xmlResponse.getElementsByTagName("z:row") : xmlResponse.getElementsByTagNameNS("*", "row");

    for (var i = 0; i < rows.length; i++) {
        var row = rows.item(i);
        var item = new Object();
        for (var j = 0; j < row.attributes.length; j++) {
            var currentNodeName = row.attributes[j].nodeName.replace('ows_', '');
            var currentNodeValue = row.attributes[j].nodeValue;
            if ((currentNodeValue == undefined) || (currentNodeValue == null)) {
                item[currentNodeName] = '';
            else {
                item[currentNodeName] = currentNodeValue;
    return items;

The function worked for me in Chrome, IE11 and Firefox. However, it seems “nodeValue” is a deprecated property, is still working, but it should be replaced with “value” property to avoid possible future problems.


One thought on “Serialize list items from lists.asmx

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s