js代码
const fs_port = require("fs"); let rawdata = fs_port.readFileSync("Config.json"); json_data =JSON.parse(rawdata); Ip_=json_data.host port_=json_data.port console.log("host:%s port:%s",Ip_,port_)
json文件
{"host":"127.0.0.1","port":"5000","username":"admin","password":"admin"}
标签:fs,json,js,host,解析,data,port From: https://www.cnblogs.com/gooutlook/p/16803091.html