Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

require a json as a string

var fs = require('fs');

fs.readFile('/path/to/file.json', 'utf8', function (err, data) {
    if (err) throw err; // we'll not consider error handling for now
    var obj = JSON.parse(data);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #require #json #string
ADD COMMENT
Topic
Name
5+2 =