I am attempting to use SPXmlToJson in conjunction with a GetListItems which worked great however; I am in need of allowing my function to dynamically pull from different lists based on a user input. Using global variables I am able to change mappedName and objectType. I am unable to use a variable for the name (ows_x) it doesn’t read the value but attempts to pull the variable name as the value. Any help would be appreciated I am relatively new to this so if it’s a simply error please forgive me.
var Json = $(xData.responseXML).SPFilterNode("z:row").SPXmlToJson({
mapping: {
removeOws: true
});
var Json = $(xData.responseXML).SPFilterNode("z:row").SPXmlToJson({
mapping: {
ows_ID: {mappedName: varX, objectType: varY}, //this works
varA: {mappedName: varB, objectType: varC} //this does not
},
includeAllAttrs: trueremoveOws: true
});