Last active
August 29, 2015 14:13
-
-
Save radjivF/e2125b8f1bbf46d44e75 to your computer and use it in GitHub Desktop.
Read a Json File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//modules required | |
var jf = require('jsonfile') | |
var util = require('util') | |
var fs = require('fs'); | |
var file = 'name_file.json' | |
function readJSON(file) { | |
fs.readFile(file, function (err, data) { | |
if (err) { | |
console.log('Error: ' + err); | |
return; | |
} | |
jsonData = JSON.parse(data); | |
jsonString= JSON.stringify(jsonData); | |
console.log(jsonString); | |
}); | |
} | |
readJSON(file); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment