How to call a unique json value, example name (the json has id, first name, last name, etc.) [closed]

-2
    fs.readFile("user.json", function (err, data) {
    if (err) throw err;
    console.log(data.toString());
});
    
asked by Leon9091 22.11.2018 в 01:57
source

1 answer

1

You could use JSON.parse, something like this:

fs.readFile("user.json", function (err, data) {
    if (err) throw err;
    obj = JSON.parse(data);
    console.log(obj.nombre);
});

Good luck!

    
answered by 22.11.2018 в 03:19