同步读取json文件并转为JSON对象

 const fs = require("fs");
 const path = require("path");
 
 const buffer = fs.readFileSync(path.resolve(__dirname, "../json/student.json"));
 const json = JSON.parse(buffer);
 console.log(json);

你可能感兴趣的:(同步读取json文件并转为JSON对象)