12 lines
271 B
JavaScript
12 lines
271 B
JavaScript
const fs = require('fs');
|
|
|
|
const dataBuffer = fs.readFileSync('1-json.json');
|
|
const dataJSON = dataBuffer.toString();
|
|
const data = JSON.parse(dataJSON);
|
|
|
|
data.name = 'Jason';
|
|
data.age = 38;
|
|
|
|
const newJSON = JSON.stringify(data);
|
|
fs.writeFileSync('1-json.json', newJSON);
|