
Help...
I am using Michael N.'s Scrypt from https://app.roll20.net/forum/post/1755413/imports-...
and have been attempting to rewrite a section of it to remove all null values exported from sheets in the below section of code but I keep going in circles.
but what I am looking for is if the json created would contain this:
I am using Michael N.'s Scrypt from https://app.roll20.net/forum/post/1755413/imports-...
and have been attempting to rewrite a section of it to remove all null values exported from sheets in the below section of code but I keep going in circles.
function exportAttributes( charID ){// My knowledge in Javascript is limited to what I learned in high school many years ago.
var attributes = findObjs({_type: "attribute", _characterid: charID});
var exported = [];
for(var i in attributes)
{
a = attributes[i];
exported.push({
"name": a.get("name"),
"current": a.get("current"),
"max": a.get("max")
});
}
return exported;
}
but what I am looking for is if the json created would contain this:
{instead of this
"name": "Generic_Attribute1",
"current": "42 is the Answer to the Ultimate Question of Life, the Universe, and Everything",
},
{
"name": "Generic_Attribute2",
"max": "11d7+33"
},
{//even if "name": "Generic_Attribute3", could not be removed it would make things better for me
"name": "Generic_Attribute1",
"current": "42 is the Answer to the Ultimate Question of Life, the Universe, and Everything",
"max": ""
},
{
"name": "Generic_Attribute2",
"current": "",
"max": "11d7+33"
},
{
"name": "Generic_Attribute3",
"current": "",
"max": ""
},