Last active
May 5, 2020 12:46
-
-
Save anmolsukki/c6d66cde34e8cfd15220d97f6ed75785 to your computer and use it in GitHub Desktop.
[ NodeJs ] Read Json File ( https://repl.it/@anmolsukki/3ReadJsonFile )
This file contains hidden or 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 dataBuffer = fs.readFileSync("person.json") | |
| console.log(dataBuffer) | |
| console.log(dataBuffer.toString()) | |
| const dataJSON = dataBuffer.toString() | |
| const data = JSON.parse(dataJSON) | |
| console.log(data.title) |
This file contains hidden or 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
| { "title": "Ego is the enemy", "author": "Ryan Holiday" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment