{"_id":"json-source-map","_rev":"207552","name":"json-source-map","description":"Parse/stringify JSON and provide source-map for JSON-pointers to all nodes","dist-tags":{"latest":"0.6.1"},"maintainers":[{"name":"esp","email":""}],"time":{"modified":"2023-03-24T08:18:12.000Z","created":"2017-01-08T22:12:26.547Z","0.6.1":"2019-08-07T10:01:14.782Z","0.6.0":"2019-08-04T19:56:42.594Z","0.5.0":"2019-08-04T19:01:03.305Z","0.4.0":"2017-01-12T20:52:01.894Z","0.3.0":"2017-01-09T11:21:35.322Z","0.2.0":"2017-01-09T08:32:09.148Z","0.1.0":"2017-01-09T00:10:40.778Z","0.0.1":"2017-01-08T22:12:26.547Z"},"users":{},"author":{"name":"Evgeny Poberezkin"},"repository":{"type":"git","url":"git+https://github.com/epoberezkin/json-source-map.git"},"versions":{"0.6.1":{"name":"json-source-map","version":"0.6.1","description":"Parse/stringify JSON and provide source-map for JSON-pointers to all nodes","main":"index.js","scripts":{"eslint":"eslint index.js spec","test-spec":"mocha spec -R spec","test-debug":"mocha spec -R spec --debug-brk","test":"npm run eslint && nyc npm run test-spec"},"repository":{"type":"git","url":"git+https://github.com/epoberezkin/json-source-map.git"},"keywords":["JSON","parse","stringify","json-pointer","source-map","BigInt","ES6","Map","Set","TypedArray"],"author":{"name":"Evgeny Poberezkin"},"license":"MIT","bugs":{"url":"https://github.com/epoberezkin/json-source-map/issues"},"homepage":"https://github.com/epoberezkin/json-source-map#readme","devDependencies":{"coveralls":"^2.11.15","eslint":"^6.1.0","json-pointer":"^0.6.0","mocha":"^3.2.0","nyc":"^10.0.0","pre-commit":"^1.2.2"},"nyc":{"exclude":["spec"],"reporter":["lcov","text-summary"]},"gitHead":"3e5886187624d662370a52a7e5e5e0d8d4aa4c05","_id":"json-source-map@0.6.1","_nodeVersion":"12.6.0","_npmVersion":"6.9.0","dist":{"shasum":"e0b1f6f4ce13a9ad57e2ae165a24d06e62c79a0f","size":9906,"noattachment":false,"key":"/json-source-map/-/json-source-map-0.6.1.tgz","tarball":"http://name.csiicloud.com:7001/json-source-map/download/json-source-map-0.6.1.tgz"},"maintainers":[{"name":"esp","email":""}],"_npmUser":{"name":"esp","email":"e.poberezkin@me.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-source-map_0.6.1_1565172074614_0.14148312472082059"},"_hasShrinkwrap":false,"publish_time":1565172074782,"_cnpm_publish_time":1565172074782,"_cnpmcore_publish_time":"2021-12-16T14:42:29.085Z"},"0.6.0":{"name":"json-source-map","version":"0.6.0","description":"Parse/stringify JSON and provide source-map for JSON-pointers to all nodes","main":"index.js","scripts":{"eslint":"eslint index.js spec","test-spec":"mocha spec -R spec","test-debug":"mocha spec -R spec --debug-brk","test":"npm run eslint && nyc npm run test-spec"},"repository":{"type":"git","url":"git+https://github.com/epoberezkin/json-source-map.git"},"keywords":["JSON","parse","stringify","json-pointer","source-map","BigInt","ES6","Map","Set","TypedArray"],"author":{"name":"Evgeny Poberezkin"},"license":"MIT","bugs":{"url":"https://github.com/epoberezkin/json-source-map/issues"},"homepage":"https://github.com/epoberezkin/json-source-map#readme","devDependencies":{"coveralls":"^2.11.15","eslint":"^6.1.0","json-pointer":"^0.6.0","mocha":"^3.2.0","nyc":"^10.0.0","pre-commit":"^1.2.2"},"nyc":{"exclude":["spec"],"reporter":["lcov","text-summary"]},"gitHead":"86c7024ea3f906b0c5c56a31309bb485ee73b6a7","_id":"json-source-map@0.6.0","_nodeVersion":"12.6.0","_npmVersion":"6.9.0","dist":{"shasum":"ae30b6bf7b82850d5c7dad25f5b0c73739151338","size":9874,"noattachment":false,"key":"/json-source-map/-/json-source-map-0.6.0.tgz","tarball":"http://name.csiicloud.com:7001/json-source-map/download/json-source-map-0.6.0.tgz"},"maintainers":[{"name":"esp","email":""}],"_npmUser":{"name":"esp","email":"e.poberezkin@me.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-source-map_0.6.0_1564948602405_0.05436121620450529"},"_hasShrinkwrap":false,"publish_time":1564948602594,"_cnpm_publish_time":1564948602594,"_cnpmcore_publish_time":"2021-12-16T14:42:29.273Z"},"0.5.0":{"name":"json-source-map","version":"0.5.0","description":"Parse/stringify JSON and provide source-map for JSON-pointers to all nodes","main":"index.js","scripts":{"eslint":"eslint index.js spec","test-spec":"mocha spec -R spec","test-debug":"mocha spec -R spec --debug-brk","test":"npm run eslint && nyc npm run test-spec"},"repository":{"type":"git","url":"git+https://github.com/epoberezkin/json-source-map.git"},"keywords":["JSON","parse","stringify","json-pointer","source-map"],"author":{"name":"Evgeny Poberezkin"},"license":"MIT","bugs":{"url":"https://github.com/epoberezkin/json-source-map/issues"},"homepage":"https://github.com/epoberezkin/json-source-map#readme","devDependencies":{"coveralls":"^2.11.15","eslint":"^6.1.0","json-pointer":"^0.6.0","mocha":"^3.2.0","nyc":"^10.0.0","pre-commit":"^1.2.2"},"nyc":{"exclude":["spec"],"reporter":["lcov","text-summary"]},"gitHead":"bb1d69a9d4c347a79fe10d8fd806f05ef8d82af8","_id":"json-source-map@0.5.0","_nodeVersion":"12.6.0","_npmVersion":"6.9.0","dist":{"shasum":"3fe63e30e1ba1cb688f66addb06e08182c8dc686","size":9408,"noattachment":false,"key":"/json-source-map/-/json-source-map-0.5.0.tgz","tarball":"http://name.csiicloud.com:7001/json-source-map/download/json-source-map-0.5.0.tgz"},"maintainers":[{"name":"esp","email":""}],"_npmUser":{"name":"esp","email":"e.poberezkin@me.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-source-map_0.5.0_1564945263174_0.037062338193311506"},"_hasShrinkwrap":false,"publish_time":1564945263305,"_cnpm_publish_time":1564945263305,"_cnpmcore_publish_time":"2021-12-16T14:42:29.485Z"},"0.4.0":{"name":"json-source-map","version":"0.4.0","description":"Parse/stringify JSON and provide source-map for JSON-pointers to all nodes","main":"index.js","scripts":{"eslint":"eslint index.js spec","test-spec":"mocha spec -R spec","test-debug":"mocha spec -R spec --debug-brk","test":"npm run eslint && nyc npm run test-spec"},"repository":{"type":"git","url":"git+https://github.com/epoberezkin/json-source-map.git"},"keywords":["JSON","parse","stringify","json-pointer","source-map"],"author":{"name":"Evgeny Poberezkin"},"license":"MIT","bugs":{"url":"https://github.com/epoberezkin/json-source-map/issues"},"homepage":"https://github.com/epoberezkin/json-source-map#readme","devDependencies":{"coveralls":"^2.11.15","eslint":"^3.13.1","json-pointer":"^0.6.0","mocha":"^3.2.0","nyc":"^10.0.0","pre-commit":"^1.2.2"},"nyc":{"exclude":["spec"],"reporter":["lcov","text-summary"]},"gitHead":"3040b5e69087e45730de48f3f0858371a422020b","_id":"json-source-map@0.4.0","_shasum":"eea837fe3ce2f2bfd5b13687779406354423c355","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.1","_npmUser":{"name":"esp","email":"e.poberezkin@me.com"},"maintainers":[{"name":"esp","email":""}],"dist":{"shasum":"eea837fe3ce2f2bfd5b13687779406354423c355","size":9240,"noattachment":false,"key":"/json-source-map/-/json-source-map-0.4.0.tgz","tarball":"http://name.csiicloud.com:7001/json-source-map/download/json-source-map-0.4.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/json-source-map-0.4.0.tgz_1484254320166_0.12348859524354339"},"directories":{},"publish_time":1484254321894,"_hasShrinkwrap":false,"_cnpm_publish_time":1484254321894,"_cnpmcore_publish_time":"2021-12-16T14:42:30.097Z"},"0.3.0":{"name":"json-source-map","version":"0.3.0","description":"Parse/stringify JSON and provide source-map for JSON-pointers to all nodes","main":"index.js","scripts":{"test-spec":"mocha spec.js -R spec","test":"nyc npm run test-spec"},"repository":{"type":"git","url":"git+https://github.com/epoberezkin/json-source-map.git"},"keywords":["JSON","parse","stringify","json-pointer","source-map"],"author":{"name":"Evgeny Poberezkin"},"license":"MIT","bugs":{"url":"https://github.com/epoberezkin/json-source-map/issues"},"homepage":"https://github.com/epoberezkin/json-source-map#readme","devDependencies":{"coveralls":"^2.11.15","json-pointer":"^0.6.0","mocha":"^3.2.0","nyc":"^10.0.0","pre-commit":"^1.2.2"},"nyc":{"exclude":["spec.js"],"reporter":["lcov","text-summary"]},"gitHead":"352598c93f1d9ee41c29eda654f31dcf25196c51","_id":"json-source-map@0.3.0","_shasum":"58c688458734955f50f9af3e1c99713c2bbeb4ee","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"esp","email":"e.poberezkin@me.com"},"maintainers":[{"name":"esp","email":""}],"dist":{"shasum":"58c688458734955f50f9af3e1c99713c2bbeb4ee","size":4087,"noattachment":false,"key":"/json-source-map/-/json-source-map-0.3.0.tgz","tarball":"http://name.csiicloud.com:7001/json-source-map/download/json-source-map-0.3.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/json-source-map-0.3.0.tgz_1483960894750_0.9630492022261024"},"directories":{},"publish_time":1483960895322,"_hasShrinkwrap":false,"_cnpm_publish_time":1483960895322,"_cnpmcore_publish_time":"2021-12-16T14:42:30.337Z"},"0.2.0":{"name":"json-source-map","version":"0.2.0","description":"Parse/stringify JSON and provide source-map for JSON-pointers to all nodes","main":"index.js","scripts":{"test-spec":"mocha spec.js -R spec","test":"nyc npm run test-spec"},"repository":{"type":"git","url":"git+https://github.com/epoberezkin/json-source-map.git"},"keywords":["JSON","parse","stringify","json-pointer","source-map"],"author":{"name":"Evgeny Poberezkin"},"license":"MIT","bugs":{"url":"https://github.com/epoberezkin/json-source-map/issues"},"homepage":"https://github.com/epoberezkin/json-source-map#readme","devDependencies":{"coveralls":"^2.11.15","json-pointer":"^0.6.0","mocha":"^3.2.0","nyc":"^10.0.0","pre-commit":"^1.2.2"},"nyc":{"exclude":["spec.js"],"reporter":["lcov","text-summary"]},"gitHead":"3c686637d2a9f368c3e01ad39b191196fb90e256","_id":"json-source-map@0.2.0","_shasum":"c126ad96f0878f7c898f74321d3d4d786874c40e","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"esp","email":"e.poberezkin@me.com"},"maintainers":[{"name":"esp","email":""}],"dist":{"shasum":"c126ad96f0878f7c898f74321d3d4d786874c40e","size":3555,"noattachment":false,"key":"/json-source-map/-/json-source-map-0.2.0.tgz","tarball":"http://name.csiicloud.com:7001/json-source-map/download/json-source-map-0.2.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/json-source-map-0.2.0.tgz_1483950727376_0.3073545591905713"},"directories":{},"publish_time":1483950729148,"_hasShrinkwrap":false,"_cnpm_publish_time":1483950729148,"_cnpmcore_publish_time":"2021-12-16T14:42:30.540Z"},"0.1.0":{"name":"json-source-map","version":"0.1.0","description":"Parse/stringify JSON and provide source-map for JSON-pointers to all nodes","main":"index.js","scripts":{"test-spec":"mocha spec.js -R spec","test":"nyc npm run test-spec"},"repository":{"type":"git","url":"git+https://github.com/epoberezkin/json-source-map.git"},"keywords":["JSON","parse","stringify","json-pointer","source-map"],"author":{"name":"Evgeny Poberezkin"},"license":"MIT","bugs":{"url":"https://github.com/epoberezkin/json-source-map/issues"},"homepage":"https://github.com/epoberezkin/json-source-map#readme","devDependencies":{"coveralls":"^2.11.15","mocha":"^3.2.0","nyc":"^10.0.0","pre-commit":"^1.2.2"},"nyc":{"exclude":["spec.js"],"reporter":["lcov","text-summary"]},"gitHead":"3ac6cba91f958d20d0161da9a6dd299c4b5a41de","_id":"json-source-map@0.1.0","_shasum":"40034aed5e1240effc063c40047a8646435b3e21","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"esp","email":"e.poberezkin@me.com"},"maintainers":[{"name":"esp","email":""}],"dist":{"shasum":"40034aed5e1240effc063c40047a8646435b3e21","size":3209,"noattachment":false,"key":"/json-source-map/-/json-source-map-0.1.0.tgz","tarball":"http://name.csiicloud.com:7001/json-source-map/download/json-source-map-0.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/json-source-map-0.1.0.tgz_1483920640108_0.5066756806336343"},"directories":{},"publish_time":1483920640778,"_hasShrinkwrap":false,"_cnpm_publish_time":1483920640778,"_cnpmcore_publish_time":"2021-12-16T14:42:30.768Z"},"0.0.1":{"name":"json-source-map","version":"0.0.1","description":"Parse/stringify JSON and provide source-map for JSON-pointers to all nodes","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/epoberezkin/json-source-map.git"},"keywords":["JSON","parse","stringify","json-pointer","source-map"],"author":{"name":"Evgeny Poberezkin"},"license":"MIT","bugs":{"url":"https://github.com/epoberezkin/json-source-map/issues"},"homepage":"https://github.com/epoberezkin/json-source-map#readme","gitHead":"991ba30b32f859cf2a106c505a5f30d8c3710a56","_id":"json-source-map@0.0.1","_shasum":"06edab7ddfff4baa2c3e61a28abf12f0ce331937","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.1","_npmUser":{"name":"esp","email":"e.poberezkin@me.com"},"maintainers":[{"name":"esp","email":""}],"dist":{"shasum":"06edab7ddfff4baa2c3e61a28abf12f0ce331937","size":1492,"noattachment":false,"key":"/json-source-map/-/json-source-map-0.0.1.tgz","tarball":"http://name.csiicloud.com:7001/json-source-map/download/json-source-map-0.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/json-source-map-0.0.1.tgz_1483913544378_0.6587374217342585"},"directories":{},"publish_time":1483913546547,"_hasShrinkwrap":false,"_cnpm_publish_time":1483913546547,"_cnpmcore_publish_time":"2021-12-16T14:42:31.003Z"}},"readme":"# json-source-map\nParse/stringify JSON and provide source-map for JSON-pointers to all nodes.\n\nNEW: supports BigInt, Maps, Sets and Typed arrays.\n\n[![Build Status](https://travis-ci.org/epoberezkin/json-source-map.svg?branch=master)](https://travis-ci.org/epoberezkin/json-source-map)\n[![npm version](https://badge.fury.io/js/json-source-map.svg)](https://www.npmjs.com/package/json-source-map)\n[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/json-source-map/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/json-source-map?branch=master)\n\n\n## Install\n\n```bash\nnpm install json-source-map\n```\n\n\n## Possible use cases\n\n#### Source maps\n\nWhen a domain-specific language that compiles to JavaScript uses JSON as a format, this module can be used as a replacement for standard JSON to simplify generation of source maps.\n\n#### Editing forms/JSON\n\nWhen a form also allows to edit JSON representation of data on the same screen, this module can be used to sinchronise navigation in JSON and in the form.\n\n\n## Usage\n\n#### Stringify\n\n```javascript\nvar jsonMap = require('json-source-map');\nvar result = jsonMap.stringify({ foo: 'bar' }, null, 2);\nconsole.log('json:');\nconsole.log(result.json);\nconsole.log('\\npointers:');\nconsole.log(result.pointers);\n```\n\noutput:\n\n```text\njson:\n{\n  \"foo\": \"bar\"\n}\n\npointers:\n{ '':\n   { value: { line: 0, column: 0, pos: 0 },\n     valueEnd: { line: 2, column: 1, pos: 18 } },\n  '/foo':\n   { key: { line: 1, column: 2, pos: 4 },\n     keyEnd: { line: 1, column: 7, pos: 9 },\n     value: { line: 1, column: 9, pos: 11 },\n     valueEnd: { line: 1, column: 14, pos: 16 } } }\n```\n\n\n#### Parse\n\n```javascript\nvar result = jsonMap.parse('{ \"foo\": \"bar\" }');\nconsole.log('data:')\nconsole.log(result.data);\nconsole.log('\\npointers:');\nconsole.log(result.pointers);\n```\n\noutput:\n```text\ndata:\n{ foo: 'bar' }\n\npointers:\n{ '':\n   { value: { line: 0, column: 0, pos: 0 },\n     valueEnd: { line: 0, column: 16, pos: 16 } },\n  '/foo':\n   { key: { line: 0, column: 2, pos: 2 },\n     keyEnd: { line: 0, column: 7, pos: 7 },\n     value: { line: 0, column: 9, pos: 9 },\n     valueEnd: { line: 0, column: 14, pos: 14 } } }\n```\n\n\n## API\n\n#### .parse(String json, Any _, Object options) -&gt; Object;\n\nParses JSON string. Returns object with properties:\n- _data_: parsed data.\n- _pointers_: an object where each key is a JSON pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)), each corresponding value is a mapping object.\n\nMapping object has properties:\n- _key_: location object (see below) of the beginning of the key in JSON string. This property is only present if parent data is an object (rather than array).\n- _keyEnd_: location of the end of the key in JSON string. This property is only present if parent data is an object.\n- _value_: location of the beginning of the value in JSON string.\n- _valueEnd_: location of the end of the value in JSON string.\n\nLocation object has properties (zero-based numbers):\n- _line_: line number in JSON file.\n- _column_: column number in JSON string (from the beginning of line).\n- _pos_: character position in JSON file (from the beginning of JSON string).\n\nOptions:\n- _bigint_: parse large integers as [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt).\n\nWhitespace:\n- the only character that increases line number in mappings is line feed ('\\n'), so if your JSON string has '\\r\\n' sequence, it will still be counted as one line,\n- both '\\r' and '\\n' are counted as a character when determining `pos` (it is possible to slice sections of JSON string using `pos` property), but `column` counter is reset when `r` or `n` is encountered,\n- tabs ('\\t') are counted as four spaces when determining `column` but as a single character for `pos`.\n\nComparison with the standard `JSON.parse`:\n- when it is not possible to parse JSON, a SyntaxError exception with exactly the same message is thrown,\n- `reviver` parameter of [JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Using_the_reviver_parameter) is not supported, but its position is reserved.\n- supports parsing large integers as [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) (with the option `bigint: true`).\n\n\n#### .stringify(Any data, Any _, String|Number|Object space) -&gt; Object;\n\nStringifies JavaScript data. Returns object with properties:\n- _json_: JSON string - stringified data.\n- _pointers_: an object where each key is a JSON-pointer, each corresponding value is a mapping object (same format as in parse method).\n\nComparison with the standard `JSON.stringify`:\n- `replacer` parameter of [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter) is not supported, but its position is reserved.\n- `space` parameter is supported, but if it is a string, it may only contain characters space, tab ('\\t'), caret return ('\\r') and line feed ('\\n') - using any other caracter throws an exception. If this parameter is an object, it is options.\n\nOptions:\n- _space_: same as `space` parameter.\n- _es6_: stringify ES6 Maps, Sets and Typed arrays (as JSON arrays).\n\n\n## License\n\n[MIT](https://github.com/epoberezkin/json-source-map/blob/master/LICENSE)\n","_attachments":{},"homepage":"https://github.com/epoberezkin/json-source-map#readme","bugs":{"url":"https://github.com/epoberezkin/json-source-map/issues"},"license":"MIT"}