Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Js

Idiom #92 Save object into JSON file

Write the contents of the object x into the file data.json.

const fs = require('fs');
fs.writeFileSync('data.json', JSON.stringify(x));
(require '[clojure.java.io :refer [file]])
(require '[jsonista.core :refer [write-value]])
(write-value (file "data.json") x)

New implementation...