Created
June 23, 2018 14:14
-
-
Save nkgrnkgr/c2bfa3c1593ac2fe69c1eda91d2ccebc to your computer and use it in GitHub Desktop.
Node.js で JSONファイルの読み込み / Object.entries をつかった key, value 同時取得の実装
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
const fs = require('fs'); | |
const json = JSON.parse(fs.readFileSync('./a.json', 'utf8')); | |
for (let o of json) { | |
for (let [key, value] of Object.entries(o)) { | |
console.log({ key, value }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment