0

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

0 Answers0