Inside my loop I am creating JSON objects like so
JSONObject = {
"manufacturer": JSON.parse(object.deviceSpecificationJson[0]).manufacturer,
"model": JSON.parse(object.deviceSpecificationJson[0]).model,
"capacity": object.capacity[0],
// etc
}
But node throws an error when capcity is undefined, some of the devices in my XML which I converted to json may not contain a value in the capacity field.
How do I tell node to keep going even if the field is undefined?