0

I am trying to get data via external API but it comes in XML. I would like to convert it to JSON before using it on another function. Anyone with an idea on how to do this, kindly help. Here is my code.

function getData() { 

 var options = {
    method: 'get',
    headers: {
        Authorization: 'Bearer ' + ak
    }
};  
var url = 'https://data.purelyhr.com/daily?ak='+ ak + '&sDate=' + start + '&eDate=' + end + '&TimeOffTypeName';
var response = UrlFetchApp.fetch(url, options); 
var response = xmlToJSON.parseString(response);

Logger.log(response)
}
Rafa Guillermo
  • 14,474
  • 3
  • 18
  • 54
Just
  • 437
  • 5
  • 15

0 Answers0