When trying to load a json file and load it into an object called players I get an error and the server stops, does anyone know why? The code;
function getjson(){
fs.readFile('./src/player.json', 'utf8', (err, jsonString) => {
if (err) {
console.log("File read failed:", err)
return
}else{
players = JSON.parse(jsonString);
}
})
}
The error;
Uncaught SyntaxError: Unexpected end of JSON input
question from:https://stackoverflow.com/questions/65944091/uncaught-syntaxerror-unexpected-end-of-json-input-nodejs