Example nodejs get info from file json

Create file json   C:\Nodejs\config.json

 

{

    "id":1,

    "author": "codewr",

    "example":"get infor from file json in nodejs"

}

 

Example:

 

var config = require( './config.json' );

console.log(config.id);

console.log(config.author);

console.log(config.example);

 

Run:

 

C:\Nodejs>node getInforFileJson.js

1

codewr

get infor from file json in nodejs