Skip to content

Instantly share code, notes, and snippets.

@gyandeeps
Created January 20, 2017 01:21
Show Gist options
  • Save gyandeeps/bf55eb56cdd6a93d002b8f4e85b56967 to your computer and use it in GitHub Desktop.
Save gyandeeps/bf55eb56cdd6a93d002b8f4e85b56967 to your computer and use it in GitHub Desktop.
var fs = require("chai").assert;
var sampleObject = {
a: 1,
b: 2,
c: {
x: 11,
y: 22
}
};
fs.writeFile("./object.json", JSON.stringify(sampleObject, null, 4), (err) => {
if (err) {
console.error(err);
return;
};
console.log("File has been created");
});
/*
Content of the file:
{
a: 1,
b: 2,
c: {
x: 11,
y: 22
}
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment