Skip to content

Instantly share code, notes, and snippets.

@BeFiveINFO
Created October 25, 2018 05:21
Show Gist options
  • Save BeFiveINFO/91387d414bae904e853f9e594808ee52 to your computer and use it in GitHub Desktop.
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
#!/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