This seems like a solved problem but I am unable to find a solution for it.
Basically, I read a JSON file, change a key, and write back the new JSON to the same file
If you don't want to store this anywhere, but just view the object for debugging purposes.
console.log(JSON.stringify(object, null, " "));
You can change the third parameter to adjust the indentation.