Note - Not affiliated with node-jsonfile
Seamlessley manage JSON files in Node.js.
npm install --save betterjsonfile
No complex API
const bjson = require('betterjsonfile')
var myVar = bjson('./file.json')
// Now, just use it as a normal JSON object. Changes will be saved automatically.
myVar.name = "Sam"
Inner objects are saved automatically as well
myVar.list = {
friends: []
}
myVar.list.friends.push('David')
You can also have betterjsonfile write in the background
// Non-synchronous
require('betterjsonfile')('./test.json',false)