I am really new to programming and development world and have a been assigned is to connect to a website API to parse data and create a text file. The problem I am encountering is the output [object Object]
const Http = new XMLHttpRequest();
const url='https://api.random.com?key=12346DD-7412-45A6-X4E5-B5D2-45D2983DF12E'; (Dummy Key)
Http.open("GET", url);
Http.send();
Http.onreadystatechange=function() {
if(this.readyState==4 && this.status==200) {
const data = JSON.parse(Http.responseText);
document.write(data);
}
}
What I get before attempting to parse is the raw data but when I try to just the following code: JSON.parse(Http.responseText). I get the following output
[object Object].