Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including jsop with all npm packages installed. Try it out:

var jsop = require("jsop")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

jsop v0.3.1

One-way data-binding for JSON files

jsop

One-way data binding for JSON files

jsop is a new kind of JSON file reader/writer for Node 0.12 and io.js powered by Object.observe.

Before

var fs = require('fs')

var config = JSON.parse(fs.readFileSync('config.json'))
config.foo = 'bar'
fs.writeFile('config.json', JSON.stringify(config), function(err) {
  if (err) throw err
})

After

var jsop = require('jsop')

var config = jsop('config.json')
config.foo = 'bar'

Changes are automatically written to file. If file doesn't exist, it will be created.

License

MIT - Typicode

* jsop is short for jsonOpen

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free