showing results for - "edit external json file in javascript"
Julián
24 Jan 2017
1fs = require('fs');
2var name = 'fileName.json';
3var m = JSON.parse(fs.readFileSync(name).toString());
4m.forEach(function(p){
5    p.name= m.name;
6});
7fs.writeFileSync(name, JSON.stringify(m));
8
Maite
11 Sep 2017
1fs = require('fs');
2var name = 'myFile.json';
3var m = JSON.parse(fs.readFileSync(name).toString());
4m.forEach(function(p){
5    p.name= m.name;
6});
7fs.writeFileSync(name, JSON.stringify(m));