Created
October 25, 2018 05:21
-
-
Save BeFiveINFO/91387d414bae904e853f9e594808ee52 to your computer and use it in GitHub Desktop.
[Node.JS] Open a JSON file and list each one of values of a key
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
#!/usr/local/bin/node | |
// require | |
var fs = require("fs"); | |
var sourceData = fs.readFileSync("ttl.json","utf8"); | |
sourceData = JSON.parse(sourceData); | |
for(const categoryName in sourceData){ | |
for(const currentItem of sourceData[categoryName]){ | |
console.log(currentItem.slug); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment