Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

json-in-place

finnp58.2kISC1.0.1

edit json in-place

json, format, preserve

readme

json-in-place

Build Status Coverage Status js-standard-style semantic-release

NPM

Change keys on a JSON string, so the change will be a minimal diff. It will not change the indentation of the string.

var inplace = require('json-in-place')
var replaced = inplace('{"a":\t{"b": "c"},\n "arr": [1,2,3],\n "d": 1 }')
  .set('a.b', {'new': 'object'})
  .set('d', 2)
  .set('arr.1', 'hi')
  .toString()
// replaced will be ''{"a":\t{"b": {"new":"object"}}, "arr": [1,"hi",3], "d": 2 }''