Skip to content

Instantly share code, notes, and snippets.

@Shafran123
Created December 27, 2019 16:31
Show Gist options
  • Save Shafran123/95af60d20324aab352e1180d0cf9bbe8 to your computer and use it in GitHub Desktop.
Save Shafran123/95af60d20324aab352e1180d0cf9bbe8 to your computer and use it in GitHub Desktop.
How to write a json file using node.js
const fs = require('fs')
const book = {
title : 'Ego is the Enemy',
author : 'Rayan Holiday'
}
const bookJSON = JSON.stringify(book)
fs.writeFileSync('1.json' , bookJSON)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment