{"id":50737646,"url":"https://github.com/vaimee/jsonpath-to-sqljsonpath","last_synced_at":"2026-06-10T15:02:00.589Z","repository":{"id":45207407,"uuid":"511478388","full_name":"vaimee/jsonpath-to-sqljsonpath","owner":"vaimee","description":"A simple utility to translate the ongoing JSONPath standard to SQL/JSONpath ISO","archived":false,"fork":false,"pushed_at":"2022-07-27T07:03:47.000Z","size":316,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-03-05T01:36:39.388Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vaimee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-07T10:13:32.000Z","updated_at":"2022-07-20T16:06:07.000Z","dependencies_parsed_at":"2022-09-22T23:22:01.004Z","dependency_job_id":null,"html_url":"https://github.com/vaimee/jsonpath-to-sqljsonpath","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/vaimee/jsonpath-to-sqljsonpath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimee%2Fjsonpath-to-sqljsonpath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimee%2Fjsonpath-to-sqljsonpath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimee%2Fjsonpath-to-sqljsonpath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimee%2Fjsonpath-to-sqljsonpath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vaimee","download_url":"https://codeload.github.com/vaimee/jsonpath-to-sqljsonpath/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimee%2Fjsonpath-to-sqljsonpath/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34157453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"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":[],"created_at":"2026-06-10T15:01:58.699Z","updated_at":"2026-06-10T15:02:00.580Z","avatar_url":"https://github.com/vaimee.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSONPath to SQL/JSONPath\n![](https://img.shields.io/badge/compliance-%20~90%25-green?style=for-the-badge) ![](https://img.shields.io/bundlephobia/min/@vaimee/jsonpath-to-sqljsonpath?style=for-the-badge)\n\nThis library is a tentative mapping of emerging [JSONPath standard](https://datatracker.ietf.org/doc/html/draft-ietf-jsonpath-base) to [SQL/JSONPath](https://www.iso.org/standard/67367.html). Currently, the library follows closely the tests reported in [jsonpath-compliance-test-suite](https://github.com/jsonpath-standard/jsonpath-compliance-test-suite) and it verifies the mapping using [PostgresSQL](https://www.postgresql.org/) as a db service.\n\n## Getting started\nThe JSONPath to SQL/JSONPath is a small TypeScript library that can be used in any NodeJS or Browser application. \n\n### Installation - Node\n```\nnpm i @vaimee/jsonpath-to-sqljsonpath\n```\n\n### Installation - Browser\nTBD\n\n## Usage\n\nThe library exports two main component: the `parser` object, and the `transform` function. When you just one to \ntranslate a [JSONPath query](https://datatracker.ietf.org/doc/html/draft-ietf-jsonpath-base) you can use the `transform` method:\n```ts\n\nimport { transform } from '@vaimee/jsonpath-to-sqljsonpath'\n\nconst queries: string[] = transform(\"$.hello.world[?@.test \u003e 3]\")\n\n``` \n\nThe result of the transformation process is a list of [SQL/JSONPath queries](https://www.iso.org/standard/67367.html) that should be issued to the database. Here is an example of how to use the queries returned to interogate a DataBase complaint with the standard: \n```ts\nimport { transform } from '@vaimee/jsonpath-to-sqljsonpath'\n\nconst queries: string[] = transform(\"$.hello.world[?@.test \u003e 3]\")\nconst queryResult = await knex.unionAll(\n\nqueries.map((query) =\u003e {\n    return knex.table(table).select(knex.raw('jsonb_path_query(document, ?) as result', query)).where({ id });\n}));\n\nconst JSONPathResult = queryResult.map((result) =\u003e {\n  return result.result;\n});\n```\n\nThe variable JSONPathResult will contain the JSONPath complaint query result.\n\n## Limitations\nThe library uses a best effort approach, but we found that some of JSONPath feature cannot be translated to SQL/JSONPath. Currently the known limitations are:\n- **Negative steps** are not supported (`\"$.array[1:5:-1]`). SQL/JSONPath is strict about the ordering of the elements selected from an array and those are always in a ascending order. Therefore, we cannot simulate a negative step that would reverse the natural order of the returned elements. \n\n## Contributing\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.\n\nIf you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag \"enhancement\". Don't forget to give the project a star! Thanks again!\n\n1. Fork the Project\n2. Create your Feature Branch (git checkout -b feature/AmazingFeature)\n3. Commit your Changes (git commit -m 'Add some AmazingFeature')\n4. Push to the Branch (git push origin feature/AmazingFeature)\n5. Open a Pull Request\n\n## Contact\n[VAIMEE](vaimee.com) - [info@vaimee.com](mailto:info@vaimee.com)\n\n[Cristiano Aguzzi](team.vaimee.com/cristiano) - [cristiano.aguzzi@vaimee.com](mailto:cristiano.aguzzi@vaimee.com)\n\n[Lorenzo Gigli]() - [lorenzo.gigli@vaimee.com](mailto:lorenzo.gigli@vaimee.com)\n\n## Acknowledgments\n\nThis library is part of [Zion](https://github.com/vaimee/zion/tree/main) a Thing Description Directory developed inside the [Ontochain](https://ontochain.ngi.eu/) European programme. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaimee%2Fjsonpath-to-sqljsonpath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaimee%2Fjsonpath-to-sqljsonpath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaimee%2Fjsonpath-to-sqljsonpath/lists"}