I want to get a user from a json file based on the id, what I have below only works if the ids are in order
 router.get('/:id', function (req, res) {
// First read existing users.
fs.readFile( __dirname + "/" + "users.json", 'utf8', function (err, data) {
    people = JSON.parse( data );
    var user =  people.users[req.params.id]
    if (err) {
        res.status = 500;
        res.send(err).end();
        return;
    }
    console.log( user );
    res.end( JSON.stringify(user));
});
})
the json:
{"users[{"firstname":"stoffel","lastname":"clement","id":9},{"firstname":"stoffel","lastname":"clement","id":1},{"firstname":"liam","lastname":"murphy","id":"2"},{"firstname":"stoffel","lastname":"murphy","id":"3"}]}
 
     
    