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 400,000 packages pre-installed, including simplejsonconf with all npm packages installed. Try it out:

var simplejsonconf = require("simplejsonconf")

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

simplejsonconf v1.0.7

Use JSON as a configuration file


Use JSON as a configuration file

For more information, see index.js

const m = require('simplejsonconf');

m.getJSON({foo: {bar: 'baz'}}, '') // => 'baz'

m.setJSON({foo: {bar: 'baz'}}, '', 'jazz') // => {foo: {bar: 'jazz'}}

m.setJSON({foo: {bar: 'baz'}}, '', 'true', {
  guess: true // Guess value type
}) // => {foo: {bar: true}}

m.setJSON({foo: {bar: 'baz', something: null}}, '', 'value', {
  prune: true // Remove nulls and prune objects
}) // => {foo: {bar: 'value'}}

// or with a proxy:

m.from({foo: {bar: 'baz'}})
 .setJSON('', 'value') // => {foo: {bar: 'value'}}
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