json-destringify
Parses JSON while eagerly destringifying. A stringification tree is returned to allow the parsed/cleaned result to be edited and converted back to the original stringified format
Installation:
$ yarn add json-destringify
$ npm install json-destringify
Build:
$ yarn build$ yarn deploy
$ npm run build$ npm run deploy
Test:
$ yarn test
$ npm run test
Usage:
; const sampleInput = JSON;// sampleInput = "{\"property\":\"true\"}" const result tree = ;// result = { property: true }// tree = { count: 1, children: { property: { count: 1 } } } const sampleOutput = ;// sampleOutput = "{\"property\":\"true\"}" const changedResult = property: false; const changedOutput = ;// changedOutput = "{\"property\":\"false\"}"
Example:
; const input = property: JSON ;/*input = { property: [ '{"key":"123"}' ] }*/ const destringified = ; const restringified = ; /*restringified = { property: [ '{"key":"123"}' ] }*/ const result tree = destringified; /*result = { property: [ { key: 123 } ] } tree = { count: 0, children: { property: { count: 0, children: [ { count: 1, children: { key: { count: 1 } } } ] } }}*/