Attempting to transform the JSON object retrieved from my Icecast server into an array for easy access to current listener statistics to display in HTML.
Below is the JavaScript code being used:
const endpoint = 'http://stream.8k.nz:8000/status-json.xsl';
const serverStats = [];
fetch(endpoint)
.then(blob => blob.json())
.then(data => serverStats.push(data));
The above code snippet inserts the object as a singular item in the array. Utilizing the spread method in ES6 does not remedy this issue, as it solely functions on arrays.