{"id":23514919,"url":"https://github.com/sophiecollard/jsonpath","last_synced_at":"2026-05-01T19:32:30.466Z","repository":{"id":269213268,"uuid":"906740841","full_name":"sophiecollard/jsonpath","owner":"sophiecollard","description":"A JSONPath implementation in Elm","archived":false,"fork":false,"pushed_at":"2024-12-29T17:29:03.000Z","size":57,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T21:44:04.754Z","etag":null,"topics":["elm","elm-lang","json","json-path","jsonpath"],"latest_commit_sha":null,"homepage":"https://jsonpath-demo.lon1.cdn.digitaloceanspaces.com/index.html","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sophiecollard.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-21T19:06:36.000Z","updated_at":"2025-01-28T19:34:57.000Z","dependencies_parsed_at":"2024-12-23T20:49:03.174Z","dependency_job_id":null,"html_url":"https://github.com/sophiecollard/jsonpath","commit_stats":null,"previous_names":["sophiecollard/elm-jsonpath","sophiecollard/jsonpath"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sophiecollard%2Fjsonpath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sophiecollard%2Fjsonpath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sophiecollard%2Fjsonpath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sophiecollard%2Fjsonpath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sophiecollard","download_url":"https://codeload.github.com/sophiecollard/jsonpath/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254029010,"owners_count":22002284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["elm","elm-lang","json","json-path","jsonpath"],"created_at":"2024-12-25T14:11:39.433Z","updated_at":"2026-05-01T19:32:25.410Z","avatar_url":"https://github.com/sophiecollard.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSONPath\n\n![build status](https://github.com/sophiecollard/jsonpath/actions/workflows/build.yml/badge.svg)\n\nA [partial](#status) implementation of the [JSONPath specification](https://www.rfc-editor.org/rfc/rfc9535) in Elm.\n\n## Live demo\n\nBefore adding this package to your project, you can try out the latest version [here](https://jsonpath-demo.lon1.cdn.digitaloceanspaces.com/index.html).\n\n## Installation\n\n```sh\nelm install sophiecollard/jsonpath\n```\n\n## Example\n\n```elm\nimport Json.Decode\nimport JsonPath\nimport JsonPath.Error exposing (Error)\n\nsampleJson : Json.Decode.Value\nsampleJson =\n    ... -- Your JSON here. See the sampleJson value in docs/Sample.elm for instance.\n\nextractedJson : Result Error Json.Decode.Value\nextractedJson =\n    JsonPath.run \"$.store.book[*].author\" sampleJson\n```\n\nThe `JsonPath` module exposes `run` and `runStrict` functions, both of which take 2 arguments:\n  1. A `String` representing a JSONPath expression\n  2. A value of type `Json.Decode.Value`\n\nRemember that you can parse a raw JSON `String` into a `Json.Decode.Value` like this:\n\n```elm\nparseJson : String -\u003e Result Json.Decode.Error Json.Decode.Value\nparseJson string =\n    Json.Decode.decodeString Json.Decode.value string\n```\n\n### `run` vs `runStrict`\n\nThe distinction between `run` and `runStrict` is best understood with an example, using the [raw](docs/sample.json) or [parsed](docs/Sample.elm) JSON sample in the [docs](docs/) folder.\n\nWith `runStrict`, attempts to extract the elements at `$.store.book[*].isbn` will fail because the first two books do not have an `isbn` key:\n\n```elm\nJsonPath.runStrict \"$.store.book[*].isbn\" sampleJson ==\n    Err (KeyNotFound [ DownIndex 0, DownKey \"book\", DownKey \"store\" ] \"isbn\")\n```\n\nWith `run` however, entries missing the `isbn` key are ignored and the ISBNs of the last two books returned:\n\n```elm\nJsonPath.run \"$.store.book[*].isbn\" sampleJson ==\n    Ok (Json.Encode.list Json.Encode.string [ \"0-553-21311-3\", \"0-395-19395-8\" ])\n```\n\nNote that this only works with JSONPath expressions which return a list of results. With expressions which return exactly one result, both functions will yield an error if an index or key is missing.\n\n```elm\nJsonPath.run \"$.store.book[5]\" sampleJson ==\n    (Err (IndexNotFound [ DownKey \"book\", DownKey \"store\" ] 5))\n```\n\n## Status\n\nThis package is a work in progress and does not yet support the full [JSONPath specification](https://www.rfc-editor.org/rfc/rfc9535). Below is a summary of the supported syntax:\n\n### Identifiers\n\n| Identifier   | Syntax | Supported |\n| ------------ | ------ | --------- |\n| Root node    | `$`    | ✅        |\n| Current node | `@`    | ❌        |\n\n### Segments\n\n| Segment     | Syntax | Example                         | Supported |\n| ----------- | ------ | ------------------------------- | --------- |\n| Children    | `.`    | `$.store.book.0.author`         | ✅        |\n| Children    | `[]`   | `$.store.book[0][author,title]` | ✅        |\n| Descendants | `..`   | `$.store..price`                | ✅        |\n| Descendants | `..[]` | `$.store..[author,title]`       | ✅        |\n\n### Selectors\n\n| Selector          | Syntax            | Example                       | Supported |\n| ----------------- | ----------------- | ----------------------------- | --------- |\n| Wildcard          | `*`               | `$.store.book[*]`             | ✅        |\n| Array slice       | `start:end:step`  | `$.store.book[0:4:-2]`        | ✅        |\n| Index             | `1`               | `$.store.book[1,2,3] `        | ✅        |\n| Name / key        | `name`            | `$.store.book[author,title]`  | ✅        |\n| Filter expression | `?\u003clogical-expr\u003e` | `$.store.book[?@.price \u003c 10]` | ❌        |\n\n## Licence\n\nCopyright 2024 [Sophie Collard](https://github.com/sophiecollard).\n\nLicensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) (the \"License\"); you may not use this software except in compliance with the License.\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsophiecollard%2Fjsonpath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsophiecollard%2Fjsonpath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsophiecollard%2Fjsonpath/lists"}