Hello guys I got some Problems wiht my Json File
The Filename is name.json
{
"name": "Gerald"
}
How can I Change the name to "Gandalf" with a function in Javascript
function changeNameJson(name){
let filename= "./name.json";
let file = fs.readFileSync(filename, 'utf8');
let nameAtTheTime = JSON.parse(file);
let newName=name;
}
I tried to find a Solution but i couldn't.
nameAtTheTime.name = nameto assign the property. You then need to return thenameAttheTimeobject to the function caller to do something else, or write it back to a file.