{"_id":"jsonpath-rfc9535","_rev":"4-2b09d8123caed00698647f6ee81612dc","name":"jsonpath-rfc9535","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.0":{"name":"jsonpath-rfc9535","version":"1.0.0","keywords":["json","jsonpath","rfc9535"],"author":{"name":"P0lip"},"license":"Apache-2.0","_id":"jsonpath-rfc9535@1.0.0","maintainers":[{"name":"p0lip","email":"jakub@rozek.tech"}],"homepage":"https://github.com/P0lip/jsonpath-rfc9535","bugs":{"url":"https://github.com/P0lip/jsonpath-rfc9535/issues"},"dist":{"shasum":"debc94f61eb67196d957eba2fc1f41f4e04f5c54","tarball":"https://registry.npmjs.org/jsonpath-rfc9535/-/jsonpath-rfc9535-1.0.0.tgz","fileCount":224,"integrity":"sha512-sGXZ3djrkiNjCNB+CETN1S7/EjZbLeiiPn5IBcvNVnhGwQvfyPSK7VOvLi/MKMz7X54El3axTC8GjnH01bQOZQ==","signatures":[{"sig":"MEUCIDPI9bm6H+APChM11H7zXeYbbyLJ3IDVnG2ECUd9Du0nAiEAixtuDMtZ9hmoRxKXuUX++6TQMCw2IniRx3aPt6wLZ+Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":703812},"type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./parser":{"types":"./dist/parser/index.d.ts","import":"./dist/parser/index.js"}},"gitHead":"0a554d5cab5cac7aacdb1b64cde3e96437376c30","scripts":{"lint":"npx @biomejs/biome check","test":"node --test --experimental-strip-types --experimental-test-coverage --test-reporter=lcov --test-reporter=dot --test-reporter-destination=lcov.info --test-reporter-destination=stdout","build":"tsc --outDir dist","prepare":"husky","type-check":"tsc --noEmit","build.parser":"peggy src/parser/grammars/grammar.peggy --output src/parser/parser.js --format es --dts"},"_npmUser":{"name":"p0lip","email":"jakub@rozek.tech"},"repository":{"url":"git+https://github.com/P0lip/jsonpath-rfc9535.git","type":"git"},"_npmVersion":"10.9.2","description":"A JSONPath implementation based on RFC 9535","directories":{},"sideEffects":false,"_nodeVersion":"22.12.0","_hasShrinkwrap":false,"packageManager":"npm@10.9.2+sha512.8ab88f10f224a0c614cb717a7f7c30499014f77134120e9c1f0211ea3cf3397592cbe483feb38e0c4b3be1c54e347292c76a1b5edb94a3289d5448484ab8ac81","devDependencies":{"husky":"^9.0.10","peggy":"^4.2.0","typescript":"^5.7.2","@biomejs/biome":"1.9.4"},"_npmOperationalInternal":{"tmp":"tmp/jsonpath-rfc9535_1.0.0_1733694699518_0.05630598201473713","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"jsonpath-rfc9535","version":"1.1.0","keywords":["json","jsonpath","rfc9535"],"author":{"name":"P0lip"},"license":"Apache-2.0","_id":"jsonpath-rfc9535@1.1.0","maintainers":[{"name":"p0lip","email":"jakub@rozek.tech"}],"homepage":"https://github.com/P0lip/jsonpath-rfc9535","bugs":{"url":"https://github.com/P0lip/jsonpath-rfc9535/issues"},"dist":{"shasum":"c3b078a746702870fcf7b7cff78c08fa8b93e782","tarball":"https://registry.npmjs.org/jsonpath-rfc9535/-/jsonpath-rfc9535-1.1.0.tgz","fileCount":355,"integrity":"sha512-Bj8ldGo67FNvj5nNsxGN7frkUcHZWqszNkfBOvfxOM1+WUa5J0PiGaflroTKOjGo2JQhOC1DZUaTv4tGzBaQLQ==","signatures":[{"sig":"MEQCICOHbp8fx8ts+CSFyDhqT1j1YDhWrlImKXGYC+kc/sKhAiAFSElFlEPGydtB3JxtoDIPlKC7bigQCJcsm9BAb5m9/w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":966652},"type":"module","types":"./dist/esm/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">=20"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./parser":{"import":{"types":"./dist/esm/parser/index.d.ts","default":"./dist/esm/parser/index.js"},"require":{"types":"./dist/commonjs/parser/index.d.ts","default":"./dist/commonjs/parser/index.js"}},"./package.json":"./package.json"},"gitHead":"c2609272c0d07c5df1808a248b1d12de9a2f268f","scripts":{"lint":"npx @biomejs/biome check","test":"node --test --experimental-strip-types --experimental-test-coverage --test-reporter=lcov --test-reporter=dot --test-reporter-destination=lcov.info --test-reporter-destination=stdout","build":"npm run build:esm && npm run build:cjs","prepare":"husky","build:cjs":"tsc --project tsconfig.cjs.json --outDir dist/commonjs && echo '{\"type\":\"commonjs\"}' > dist/commonjs/package.json","build:esm":"tsc --outDir dist/esm && echo '{\"type\":\"module\"}' > dist/esm/package.json","type-check":"tsc --noEmit","build.parser":"peggy src/parser/grammars/grammar.peggy --output src/parser/parser.js --format es --dts"},"_npmUser":{"name":"p0lip","email":"jakub@rozek.tech"},"repository":{"url":"git+https://github.com/P0lip/jsonpath-rfc9535.git","type":"git"},"_npmVersion":"10.9.2","description":"A JSONPath implementation based on RFC 9535","directories":{},"sideEffects":false,"_nodeVersion":"22.12.0","_hasShrinkwrap":false,"packageManager":"npm@10.9.2+sha512.8ab88f10f224a0c614cb717a7f7c30499014f77134120e9c1f0211ea3cf3397592cbe483feb38e0c4b3be1c54e347292c76a1b5edb94a3289d5448484ab8ac81","devDependencies":{"husky":"^9.0.10","peggy":"^4.2.0","typescript":"^5.7.2","@biomejs/biome":"1.9.4"},"_npmOperationalInternal":{"tmp":"tmp/jsonpath-rfc9535_1.1.0_1739127612633_0.589319404383376","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"jsonpath-rfc9535","version":"1.2.0","keywords":["json","jsonpath","rfc9535"],"author":{"name":"P0lip"},"license":"Apache-2.0","_id":"jsonpath-rfc9535@1.2.0","maintainers":[{"name":"p0lip","email":"jakub@rozek.tech"}],"homepage":"https://github.com/P0lip/jsonpath-rfc9535","bugs":{"url":"https://github.com/P0lip/jsonpath-rfc9535/issues"},"dist":{"shasum":"f32d7217dca23a959cd2bd729f698340a1062aac","tarball":"https://registry.npmjs.org/jsonpath-rfc9535/-/jsonpath-rfc9535-1.2.0.tgz","fileCount":363,"integrity":"sha512-Y7SNIEl0mzAYyI4BrCq//Z/OdOG3IvrNBuqehNYX7mzHhodO1E1DfpolEMIYa4g8G38p2Lsnegje9QQciLEgkg==","signatures":[{"sig":"MEUCIQC3PzMyGu29qhN8Ssvm2XtZ9UVDWT384Beeu1LdG93tgAIgQJYnJGIBx+GsZ3u3eD2YgoxZkeqynhMSAzeI0cbqYR8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1100985},"type":"module","types":"./dist/esm/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">=20"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./parser":{"import":{"types":"./dist/esm/parser/index.d.ts","default":"./dist/esm/parser/index.js"},"require":{"types":"./dist/commonjs/parser/index.d.ts","default":"./dist/commonjs/parser/index.js"}},"./package.json":"./package.json"},"gitHead":"7efeea112afe09f5b5e5aa066c64032441820eed","scripts":{"lint":"npx @biomejs/biome check","test":"node --test --experimental-strip-types --experimental-test-coverage --test-reporter=lcov --test-reporter=dot --test-reporter-destination=lcov.info --test-reporter-destination=stdout","build":"npm run build:esm && npm run build:cjs","prepare":"husky","build:cjs":"tsc --project tsconfig.cjs.json --outDir dist/commonjs && echo '{\"type\":\"commonjs\"}' > dist/commonjs/package.json","build:esm":"tsc --outDir dist/esm && echo '{\"type\":\"module\"}' > dist/esm/package.json","type-check":"tsc --noEmit","build.parser":"peggy src/parser/grammars/grammar.peggy --output src/parser/parser.js --format es --dts"},"_npmUser":{"name":"p0lip","email":"jakub@rozek.tech"},"repository":{"url":"git+https://github.com/P0lip/jsonpath-rfc9535.git","type":"git"},"_npmVersion":"10.9.2","description":"A JSONPath implementation based on RFC 9535","directories":{},"sideEffects":false,"_nodeVersion":"22.12.0","_hasShrinkwrap":false,"packageManager":"npm@10.9.2+sha512.8ab88f10f224a0c614cb717a7f7c30499014f77134120e9c1f0211ea3cf3397592cbe483feb38e0c4b3be1c54e347292c76a1b5edb94a3289d5448484ab8ac81","devDependencies":{"husky":"^9.0.10","peggy":"^4.2.0","typescript":"^5.7.2","@biomejs/biome":"1.9.4"},"_npmOperationalInternal":{"tmp":"tmp/jsonpath-rfc9535_1.2.0_1743532549444_0.6816318819563763","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"jsonpath-rfc9535","version":"1.3.0","description":"A JSONPath implementation based on RFC 9535","keywords":["json","jsonpath","rfc9535"],"homepage":"https://github.com/P0lip/jsonpath-rfc9535","bugs":{"url":"https://github.com/P0lip/jsonpath-rfc9535/issues"},"engines":{"node":">=20"},"type":"module","types":"./dist/esm/index.d.ts","module":"./dist/esm/index.js","exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json","./parser":{"import":{"types":"./dist/esm/parser/index.d.ts","default":"./dist/esm/parser/index.js"},"require":{"types":"./dist/commonjs/parser/index.d.ts","default":"./dist/commonjs/parser/index.js"}}},"sideEffects":false,"license":"Apache-2.0","author":{"name":"P0lip"},"repository":{"type":"git","url":"git+https://github.com/P0lip/jsonpath-rfc9535.git"},"scripts":{"build:esm":"tsc --outDir dist/esm && echo '{\"type\":\"module\"}' > dist/esm/package.json","build:cjs":"tsc --project tsconfig.cjs.json --outDir dist/commonjs && echo '{\"type\":\"commonjs\"}' > dist/commonjs/package.json","build":"npm run build:esm && npm run build:cjs","build.parser":"peggy src/parser/grammars/grammar.peggy --output src/parser/parser.js --format es --dts","lint":"npx @biomejs/biome check","type-check":"tsc --noEmit","test":"node --test --experimental-strip-types --experimental-test-coverage --test-reporter=lcov --test-reporter=dot --test-reporter-destination=lcov.info --test-reporter-destination=stdout","prepare":"husky"},"devDependencies":{"@biomejs/biome":"1.9.4","husky":"^9.0.10","peggy":"^4.2.0","typescript":"^5.7.2"},"packageManager":"npm@10.9.2+sha512.8ab88f10f224a0c614cb717a7f7c30499014f77134120e9c1f0211ea3cf3397592cbe483feb38e0c4b3be1c54e347292c76a1b5edb94a3289d5448484ab8ac81","_id":"jsonpath-rfc9535@1.3.0","gitHead":"5be8a3f6b4e0c81872bf73f260ca5c5f76b57d0a","_nodeVersion":"22.12.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-3jFHya7oZ45aDxIIdx+/zQARahHXxFSMWBkcBUldfXpLS9VCXDJyTKt35kQfEXLqh0K3Ixw/9xFnvcDStaxh7Q==","shasum":"b8c6e845a92f09feee221022dd70f6e70e26b196","tarball":"https://registry.npmjs.org/jsonpath-rfc9535/-/jsonpath-rfc9535-1.3.0.tgz","fileCount":363,"unpackedSize":1102232,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIF6es8qwbVFiVjlTv2YNU+1m/6r5onJ/LZXHaZ82bOVxAiBE/hmWzZDE0kQA/w9q7v5I4BnFUTd6GHYnWpOgMyW6NA=="}]},"_npmUser":{"name":"p0lip","email":"jakub@rozek.tech"},"directories":{},"maintainers":[{"name":"p0lip","email":"jakub@rozek.tech"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/jsonpath-rfc9535_1.3.0_1743786404290_0.3323892138489437"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-08T21:51:39.517Z","modified":"2025-04-04T17:06:44.736Z","1.0.0":"2024-12-08T21:51:39.922Z","1.1.0":"2025-02-09T19:00:12.842Z","1.2.0":"2025-04-01T18:35:49.631Z","1.3.0":"2025-04-04T17:06:44.555Z"},"bugs":{"url":"https://github.com/P0lip/jsonpath-rfc9535/issues"},"author":{"name":"P0lip"},"license":"Apache-2.0","homepage":"https://github.com/P0lip/jsonpath-rfc9535","keywords":["json","jsonpath","rfc9535"],"repository":{"type":"git","url":"git+https://github.com/P0lip/jsonpath-rfc9535.git"},"description":"A JSONPath implementation based on RFC 9535","maintainers":[{"name":"p0lip","email":"jakub@rozek.tech"}],"readme":"# jsonpath-rfc9535\n\nA JSONPath implementation based on [RFC 9535](https://datatracker.ietf.org/doc/rfc9535/).\n\nWorks in any environment complying with ECMAScript 2022.\n\nThe package has no runtime dependencies.\n\nIt passes the entire [JSONPath Compliance Test Suite](https://github.com/jsonpath-standard/jsonpath-compliance-test-suite) with a 100% success rate (tested against commit 05f6cac).\n\nIf you are interested in a legacy specification, please check out my other package [nimma](https://github.com/P0lip/nimma).\n\n## Installation\n\nTo install the package, you can use npm:\n\n```sh\nnpm install jsonpath-rfc9535\n```\n\nor a package manager of your choice.\n\n## Usage\n\nGiven any JSON value, you have the following functions at your disposal.\n\n### query function\n\nThe `query` function retrieves an array of all matched values.\n\n```js\nimport { query } from 'jsonpath-rfc9535';\n\nconst document = {\n  \"store\": {\n    \"book\": [\n      {\n        \"category\": \"reference\",\n        \"author\": \"Nigel Rees\",\n        \"title\": \"Sayings of the Century\",\n        \"price\": 8.95,\n      },\n      {\n        \"category\": \"fiction\",\n        \"author\": \"Evelyn Waugh\",\n        \"title\": \"Sword of Honour\",\n        \"price\": 12.99,\n      },\n      {\n        \"category\": \"fiction\",\n        \"author\": \"Herman Melville\",\n        \"title\": \"Moby Dick\",\n        \"isbn\": \"0-553-21311-3\",\n        \"price\": 8.99,\n      },\n      {\n        \"category\": \"fiction\",\n        \"author\": \"J. R. R. Tolkien\",\n        \"title\": \"The Lord of the Rings\",\n        \"isbn\": \"0-395-19395-8\",\n        \"price\": 22.99,\n      },\n    ],\n    \"bicycle\": {\n      \"color\": \"red\",\n      \"price\": 399,\n    },\n  },\n};\n\nconst path = '$.store.book[*].author';\nconst result = query(document, path);\n\nconsole.log(result); // Prints: ['Nigel Rees', 'Evelyn Waugh', 'Herman Melville', 'J. R. R. Tolkien']\n```\n\n### paths\n\nThe `paths` function retrieves an array of all normalized paths of matched inputs.\n\n```ts\nimport { paths } from 'jsonpath-rfc9535';\n\nconst document = {\n  // ...\n}\n\nconst path = '$.store.book[*].author';\nconst result = paths(document, path);\n\nconsole.log(result); // Prints an array consisting of the following values:\n// \"$['store']['book'][0]['author']\",\n// \"$['store']['book'][1]['author']\",\n// \"$['store']['book'][2]['author']\",\n// \"$['store']['book'][3]['author']\"\n```\n\n### exec\n\nIf you need both the value and the path, you can use `exec` member that takes a callback.\nThe callback accepts two parameters:\n- `value` - the evaluated JSON Value\n- `path` - the expanded path for the location of the value. Note that keys are normalized according to the normalized path rules.\n\n```ts\nimport { exec } from 'jsonpath-rfc9535';\n\nconst document = {\n  // ...\n}\n\nconst path = '$.store.book[*].author';\nconst result = exec(document, path, (value, path) => {\n  // consume matched value and/or path\n});\n```\n## Parser\n\nThe parser is generated using [Peggy](https://peggyjs.org/). In the future, I would like to merge it with the Nimma's [parser](https://github.com/P0lip/nimma/blob/master/src/parser/parser.mjs) to shrink down the package size as well as improve the performance.\n\nThe parser can be imported as a standalone module:\n\n```js\nimport parse from 'jsonpath-rfc9535/parser';\n\nconst ast = parse('$.store.book[*].author');\n// consume ast\n```\n\n## Regular Expressions\n\nBear in mind that `match` and `search` functions accept regular expressions in the form of I-Regexp ([RFC 9485](https://datatracker.ietf.org/doc/rfc9485/)).\nThese regular expressions are largely compatible with the standard ECMAScript regular expressions, but there is one relatively minor difference.\nIn I-Regexp, the dot (.) character matches any character except for `\\n` and `\\r`.\nOn top of that, Unicode is enabled by default.\n\n## Custom Function Extensions\n\nAt the moment, custom function extensions are not supported.\nHowever, the API is designed to support them, so they might be added in the future if there is a demand for them.\n","readmeFilename":"README.md"}