Skip to content

Instantly share code, notes, and snippets.

@gyandeeps
Created January 20, 2017 01:20
Show Gist options
  • Save gyandeeps/151ef0a81d81214371a3fc628423b6a3 to your computer and use it in GitHub Desktop.
Save gyandeeps/151ef0a81d81214371a3fc628423b6a3 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), (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