Error message: “Unexpected token ‘<‘, “<!DOCTYPE “… is not valid JSON” keeps showing when I run my program using parcel, but when I use live server it’s seems to be fine. The error seems to happen in this code block where I tried to fetch a json file that I made. The file path is correct because it works in the live server.
Error happens at state.cards = await cards.json()
const _loadCards = async function () {
try {
const cards = await fetch("./cards.json");
state.cards = await cards.json();
} catch (err) {
console.err(err);
}
};
_loadCards();
File Structure: