{"id":20529722,"url":"https://github.com/7ph/json-cursor-path","last_synced_at":"2026-01-23T02:39:47.273Z","repository":{"id":246984121,"uuid":"822681765","full_name":"7PH/json-cursor-path","owner":"7PH","description":"Convert a cursor position in a JSON file to the path in the parsed JSON object","archived":false,"fork":false,"pushed_at":"2024-07-08T22:57:47.000Z","size":289,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-12T11:58:56.008Z","etag":null,"topics":["json","json-parser","json-path"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/7PH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-01T15:45:57.000Z","updated_at":"2024-12-21T01:31:01.000Z","dependencies_parsed_at":"2024-07-06T02:57:56.279Z","dependency_job_id":"d2998fed-69d2-4d80-9c6a-43bef29515a6","html_url":"https://github.com/7PH/json-cursor-path","commit_stats":null,"previous_names":["7ph/json-position-to-path"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/7PH/json-cursor-path","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7PH%2Fjson-cursor-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7PH%2Fjson-cursor-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7PH%2Fjson-cursor-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7PH%2Fjson-cursor-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/7PH","download_url":"https://codeload.github.com/7PH/json-cursor-path/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7PH%2Fjson-cursor-path/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28679137,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T01:00:35.747Z","status":"online","status_checked_at":"2026-01-23T02:00:08.296Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","json-parser","json-path"],"created_at":"2024-11-15T23:33:51.549Z","updated_at":"2026-01-23T02:39:47.267Z","avatar_url":"https://github.com/7PH.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-cursor-path\n\n![coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)\n![size](https://img.shields.io/badge/size-~1KB-blue)\n\nGet the JSONPath at any cursor position in JSON text. Perfect for editor plugins, JSON tools, and autocomplete features.\n\n## Getting started\n\n1. Install `json-cursor-path`\n\n   ```bash\n   npm i --save json-cursor-path\n   ```\n\n2. Import JsonCursorPath using ES import\n\n   ```js\n   import { JsonCursorPath } from \"json-cursor-path\";\n   ```\n\n3. Create an instance and pass the raw JSON file\n\n   ```js\n   const cursorPath = new JsonCursorPath(\n     '{\\n  \"key\": [\\n    \"val1\",\\n    \"val2\"\\n  ]\\n}'\n   );\n   ```\n\n4. Get the path corresponding to a cursor position\n\n   ```js\n   console.log(cursorPath.get(20));\n   /**\n    * Output: \"$.key[0]\"\n    */\n\n   console.log(cursorPath.get(20, true));\n   /**\n    * Output: [\n    *    { type: 'object', key: 'key' },\n    *    { type: 'array', index: 0 }\n    * ]\n    */\n   ```\n\n## Performance\n\n`O(n)` (cost of traversing the JSON until the specified cursor)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F7ph%2Fjson-cursor-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F7ph%2Fjson-cursor-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F7ph%2Fjson-cursor-path/lists"}