{"_id":"@aforemendude/json-parse","_rev":"2-1fcab61bdcf3fbd28bce282b21ca07fc","name":"@aforemendude/json-parse","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@aforemendude/json-parse","version":"1.0.0","keywords":["json","parse","serialize","lossless","typescript"],"author":{"name":"aforemendude"},"license":"MIT","_id":"@aforemendude/json-parse@1.0.0","maintainers":[{"name":"aforemendude","email":"aforementioned.dude@gmail.com"}],"homepage":"https://github.com/aforemendude/json-parse","bugs":{"url":"https://github.com/aforemendude/json-parse/issues"},"dist":{"shasum":"70570f1ec63b10f12a2d051aca5e6a58fb1e2455","tarball":"https://registry.npmjs.org/@aforemendude/json-parse/-/json-parse-1.0.0.tgz","fileCount":13,"integrity":"sha512-uj+3f+6QW08TITxmWkRv4cX+ThgWQLM3tJEwXiF+Jb92P7GfF38XIg0mH/trg5L8e/1QcZmWsuWp8XxqwwUgpw==","signatures":[{"sig":"MEUCIHwXx9mNaGp/+IBH4rmQOKDOmjgCLKD1vUEXRZJaFPfHAiEA2USM0H8GZY+PeZhxcUJPcrdAWNM/iOpRT5ehYYtno+A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":21030},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=20.0.0"},"gitHead":"ebee2d5c811818f9bb193cc5d608128d687bb626","scripts":{"test":"vitest run","build":"npm run clean && tsc","clean":"node scripts/clean.mjs","format":"prettier --write --cache --cache-strategy metadata .","verify":"prettier --check . && npm run build && npm run test","prepack":"npm install && git diff --exit-code -- package-lock.json && npm run verify","test:watch":"vitest","format:check":"prettier --check --cache --cache-strategy metadata .","format:nocache":"prettier --write ."},"_npmUser":{"name":"aforemendude","email":"aforementioned.dude@gmail.com"},"devEngines":{"runtime":{"name":"node","onFail":"error","version":">=22.12.0"}},"repository":{"url":"git+https://github.com/aforemendude/json-parse.git","type":"git"},"_npmVersion":"11.16.0","description":"A lossless ECMA-404 JSON parser and pretty serializer.","directories":{},"_nodeVersion":"24.18.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.10","prettier":"3.9.6","typescript":"7.0.2","@types/node":"20.19.43"},"_npmOperationalInternal":{"tmp":"tmp/json-parse_1.0.0_1786578939873_0.2526931203428211","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"author":{"name":"aforemendude"},"bugs":{"url":"https://github.com/aforemendude/json-parse/issues"},"description":"A lossless ECMA-404 JSON parser and pretty serializer.","devDependencies":{"@types/node":"20.19.43","prettier":"3.9.6","typescript":"7.0.2","vitest":"4.1.10"},"devEngines":{"runtime":{"name":"node","onFail":"error","version":">=22.12.0"}},"engines":{"node":">=20.0.0"},"homepage":"https://github.com/aforemendude/json-parse","keywords":["json","parse","serialize","lossless","typescript"],"license":"MIT","main":"./dist/index.js","name":"@aforemendude/json-parse","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/aforemendude/json-parse.git"},"scripts":{"build":"npm run clean && tsc","clean":"node scripts/clean.mjs","format":"prettier --write --cache --cache-strategy metadata .","format:check":"prettier --check --cache --cache-strategy metadata .","format:nocache":"prettier --write .","prepack":"npm install && git diff --exit-code -- package-lock.json && npm run verify","test":"vitest run","test:watch":"vitest","verify":"prettier --check . && npm run build && npm run test"},"types":"./dist/index.d.ts","version":"1.0.1","gitHead":"fc17292e92f0e7e70eebf2c3ac0985e2cf47e58f","_id":"@aforemendude/json-parse@1.0.1","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-sZnJ+V+QEz4xwQLMYbjQzB1N9zySTkqeqgNLQVadBEtyks/FT6UybfukSZC2dDFg1VTx/5hHZ8DHPGF2sXQ+8Q==","shasum":"03bcd7ee06f75f74f18032641a4a7dbc7829c7c4","tarball":"https://registry.npmjs.org/@aforemendude/json-parse/-/json-parse-1.0.1.tgz","fileCount":13,"unpackedSize":21250,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC09tELBJEtsWB4Di4mW8qKWjpLJnboavZAF74F1mhaegIganwOqnxuloB51SkJwEH2Ogr/c5xq0TZhzZ+LPfQqypY="}]},"_npmUser":{"name":"aforemendude","email":"aforementioned.dude@gmail.com"},"directories":{},"maintainers":[{"name":"aforemendude","email":"aforementioned.dude@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/json-parse_1.0.1_1786588352654_0.6669436360063783"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-12T23:55:39.661Z","modified":"2026-08-13T02:32:32.951Z","1.0.0":"2026-08-12T23:55:40.028Z","1.0.1":"2026-08-13T02:32:32.801Z"},"bugs":{"url":"https://github.com/aforemendude/json-parse/issues"},"author":{"name":"aforemendude"},"license":"MIT","homepage":"https://github.com/aforemendude/json-parse","keywords":["json","parse","serialize","lossless","typescript"],"repository":{"type":"git","url":"git+https://github.com/aforemendude/json-parse.git"},"description":"A lossless ECMA-404 JSON parser and pretty serializer.","maintainers":[{"name":"aforemendude","email":"aforementioned.dude@gmail.com"}],"readme":"# JSON Parse\n\nAn ECMA-404-compliant, lossless JSON parser and pretty serializer for Node.js and browsers.\n\nThe parser returns a compact tagged-tuple tree instead of ordinary JavaScript objects and numbers. That representation\nkeeps object members in order and retains the exact source spelling of strings, keys, and numbers, so duplicate keys and\nvalues outside JavaScript's numeric range are not lost.\n\n## Requirements\n\n- Node.js 20 or newer for direct Node.js use\n- npm for installation\n\nThe library also works in browsers when included through a bundler. Its runtime code uses only standard JavaScript APIs\nand does not depend on Node.js-specific APIs.\n\n## Installation\n\n```bash\nnpm install @aforemendude/json-parse\n```\n\n## Usage\n\n```typescript\nimport { parseJson, serializeJson } from '@aforemendude/json-parse';\n\nconst value = parseJson('{\"z\":1e+400,\"a\":1,\"a\":2}');\n\nserializeJson(value);\n// {\n//   \"z\": 1e+400,\n//   \"a\": 1,\n//   \"a\": 2\n// }\n\nserializeJson(value, { sortKeys: true });\n// {\n//   \"a\": 1,\n//   \"a\": 2,\n//   \"z\": 1e+400\n// }\n```\n\n`serializeJson` always uses two spaces, formats every non-empty container over multiple lines, and does not add a final\nnewline. By default it retains member order. With `sortKeys: true`, it recursively sorts object members by the decoded\nkey's UTF-16 value. Sorting is stable, so duplicate keys keep their original relative order. Arrays are never reordered.\n\nInsignificant source whitespace is intentionally discarded. Primitive and key tokens retain their original spelling,\nincluding escape choices, exponent formatting, trailing fractional zeroes, and negative zero.\n\nInvalid input throws a `SyntaxError`. The message includes a position but is not intended to match `JSON.parse` exactly.\n\n## API\n\n```typescript\nparseJson(input: string): JsonValue;\n\nserializeJson(value: JsonValue, options?: {\n  readonly sortKeys?: boolean;\n}): string;\n```\n\nThe serializer expects the `JsonValue` returned by `parseJson`. The tree types are exported for TypeScript users, but\nthe representation should generally be treated as an internal, immutable value.\n\n## Development\n\nDevelopment requires Node.js 22.12 or newer. The published library continues to support Node.js 20 or newer.\n\n```bash\n# Compile TypeScript\nnpm run build\n\n# Check formatting, reusing cached results\nnpm run format:check\n\n# Format code with Prettier, reusing cached results\nnpm run format\n\n# Format code with Prettier and clear cached results\nnpm run format:nocache\n\n# Run unit tests\nnpm run test\n\n# Run tests in watch mode\nnpm run test:watch\n\n# Run an uncached formatting check, compile, and test\nnpm run verify\n```\n","readmeFilename":"README.md"}