function isArray (value) {
  if (Array.isArray) {
    return Array.isArray(value);
  }
  // fallback for older browsers like  IE 8
  return Object.prototype.toString.call( value ) === '[object Array]';
}
This code is stripped down version of https://github.com/ibm-maximo-dev/xml-js
Only essential part to convert JSON to XML is used here.

Ideally there should be no updates needed to this code as it already handles all types of data for JSON object.
But in case this need updates, take a look at below file specifically from which this logic was inspired from.

https://github.com/ibm-maximo-dev/xml-js/blob/master/lib/js2xml.js