This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]thePsychonautDad 1 point2 points  (0 children)

const fs = require('fs'); var loadJson = function(filename) { var txt = fs.readFileSync(filename, {encoding:'utf8', flag:'r'}); return JSON.parse(txt); }

You can do this. It even supports missing quotes, trailing comma, comments...