This project has moved and is read-only. For the latest updates, please go here.

SPGetListItemsJson object property not returned when null value.

Feb 27, 2015 at 10:12 PM
Edited Mar 10, 2015 at 7:59 PM

First, sorry about my post title, it should be "SPGetListItemsJson object property not returned when a field value is an empty string"

I'm calling SPGetListItemsJson with my own mapping. However, when a field has an empty string value, the field is not available in the returned object. It is like if the SPXmlToJson sparse value was true. I'm probably missing something..

Here is my code
                var CAML = {'Fields':'<ViewFields><FieldRef Name="ID" />' +
                                     '<FieldRef Name="MFW3TreeOwner" />' + 
                                     '<FieldRef Name="MFW3TreeMeetingDate" />' +
                                     '<FieldRef Name="MFW3TreeItem01Indicator" /><FieldRef Name="MFW3TreeItem01" />' + 
                                     '<FieldRef Name="MFW3TreeItem02Indicator" /><FieldRef Name="MFW3TreeItem02" />' +
                                     '<FieldRef Name="MFW3TreeItem03Indicator" /><FieldRef Name="MFW3TreeItem03" />' +
                                     '<FieldRef Name="MFW3TreeOpportunityThreatIndicat" /><FieldRef Name="MFW3TreeOpportunityThreat" />' +             
                    'Where': getWhereClause(membersDataSet),
                    'Mapping': {ows_ID: {mappedName: "ID", objectType: "Counter"},
                        ows_MFW3TreeOwner: { mappedName: "Owner", objectType: "User" },
                        ows_MFW3TreeMeetingDate: {mappedName: "MeetingDate", objectType: "DateTime"},
                        ows_MFW3TreeItem01Indicator: {mappedName: "ItemIndicator01", objectType: "Text"},
                        ows_MFW3TreeItem01: {mappedName: "Item01", objectType: "Text"},
                        ows_MFW3TreeItem02Indicator: {mappedName: "ItemIndicator02", objectType: "Text"},
                        ows_MFW3TreeItem02: {mappedName: "Item02", objectType: "Text"},
                        ows_MFW3TreeItem03Indicator: {mappedName: "ItemIndicator03", objectType: "Text"},
                        ows_MFW3TreeItem03: {mappedName: "Item03", objectType: "Text"},
                        ows_MFW3TreeOpportunityThreatIndicat: {mappedName: "ItemIndicator04", objectType: "Text"},
                        ows_MFW3TreeOpportunityThreat: {mappedName: "OpportunityThreat", objectType: "Text"}},

                    'Options' : ''
                var promise = $().SPServices.SPGetListItemsJson({
                    webURL: Unika.Central.urlFramework,
                    listName: listInfo.GUID,
                    CAMLQuery: CAML.Where,
                    CAMLViewFields: CAML.Fields,
                    CAMLQueryOptions: CAML.Options,
                    mapping : CAML.Mapping
Object returned: