JSPM

json-in-place

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13891
  • Score
    100M100P100Q174193F
  • License ISC

edit json in-place

Package Exports

  • json-in-place

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (json-in-place) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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 }''