commonfields:
  id: ConvertXmlFileToJson
  version: -1
name: ConvertXmlFileToJson
script: |-
  var xml = getFileByEntryID(args.entryID);
  var xmlJson = x2j(xml);
  try {
    xmlJson = JSON.parse(xmlJson);
  } catch(err) {}

  if (args.contextKey && args.contextKey.length > 0) {
      setContext(args.contextKey,xmlJson);
  }
  if (args.verbose && args.verbose.length > 0 && args.verbose == 'True'){
      return xmlJson;
  }
type: javascript
tags:
- Utility
comment: Converts XML file entry to JSON format
enabled: true
args:
- name: entryID
  required: true
  default: true
  description: Entry ID of a valid xml file to convert to json format
- name: contextKey
  description: context Key to push json result to
- name: verbose
  auto: PREDEFINED
  predefined:
  - "True"
  - "False"
  description: Print json result to warrom
scripttarget: 0

Allow conversion from XML files
Allow conversion from XML files
