To access the content, you must save the file onto your device as the website does not allow external requests.
const fs = require("fs");
function generateRandomIndex(size) {
return Math.floor(Math.random() * size);
}
const quotesCollection = JSON.parse(fs.readFileSync("quotes.json", { encoding: "utf-8", flag: "r" }));
const selectedQuote = quotesCollection[generateRandomIndex(quotesCollection.length)];
document.getElementById("quote").innerHTML = `"${selectedQuote.QUOTE}" - ${selectedQuote.AUTHOR} (genre: ${selectedQuote.GENRE})`;
<span id="quote">Your chosen quote will appear here</span>