{"id":32173328,"url":"https://github.com/mtannaan/elixpath","last_synced_at":"2026-02-19T07:03:01.936Z","repository":{"id":49267392,"uuid":"188409394","full_name":"mtannaan/elixpath","owner":"mtannaan","description":"JSONPath-like operations for Elixir's native data structure","archived":false,"fork":false,"pushed_at":"2025-05-19T14:25:36.000Z","size":334,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-01T08:02:04.658Z","etag":null,"topics":["elixir","elixpath","jsonpath","xpath"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/mtannaan.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,"zenodo":null}},"created_at":"2019-05-24T11:21:50.000Z","updated_at":"2025-05-19T14:23:31.000Z","dependencies_parsed_at":"2025-05-20T19:31:59.250Z","dependency_job_id":null,"html_url":"https://github.com/mtannaan/elixpath","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mtannaan/elixpath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtannaan%2Felixpath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtannaan%2Felixpath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtannaan%2Felixpath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtannaan%2Felixpath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtannaan","download_url":"https://codeload.github.com/mtannaan/elixpath/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtannaan%2Felixpath/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29605807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["elixir","elixpath","jsonpath","xpath"],"created_at":"2025-10-21T18:52:28.948Z","updated_at":"2026-02-19T07:03:01.930Z","avatar_url":"https://github.com/mtannaan.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elixpath\n\n[![.github/workflows/ci.yml](https://github.com/mtannaan/elixpath/actions/workflows/ci.yml/badge.svg)](https://github.com/mtannaan/elixpath/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/mtannaan/elixpath/branch/master/graph/badge.svg)](https://codecov.io/gh/mtannaan/elixpath)\n[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/mtannaan/elixpath/blob/master/LICENSE)\n[![Hex.pm](https://img.shields.io/hexpm/v/elixpath.svg)](https://hex.pm/packages/elixpath)\n[![hexdocs.pm](https://img.shields.io/badge/hex-docs-orange.svg)](https://hexdocs.pm/elixpath/)\n[![Hex.pm](https://img.shields.io/hexpm/dt/elixpath.svg)](https://hex.pm/packages/elixpath)\n\nExtract data from Elixir's native data structure using JSONPath-like path expressions.\n\n## Searching for XPath Tools?\n\nIf you are planning to manipulate XML documents directly, other packages like [sweet_xml](https://hex.pm/packages/sweet_xml) can be better choices.\n\n## Elixpath Expression\n\nElixpath's path expression is based on [JSONPath](https://goessner.net/articles/JsonPath/),\nbut mainly with following differences:\n\n- Following Elixir's native expressions are supported:\n  - String, e.g. `..string.\"double-quoted string\"`\n  - Atom, e.g. `.:atom.:\"quoted atom\"`\n  - Charlist, e.g. `.'single-quoted'`\n  - Integer, e.g. `[1][-1]`\n- Several JSONPath features like following are not supported:\n  - \"Current object\" syntax element: `@`\n  - Union subscript operator: `[xxx,yyy]`\n  - Array slice operator: `[start:end:stop]`\n  - Filter and script expression using `()`\n\n## Path Syntax\n\nAn Elixpath is represented by a sequence of following path components.\n\n- `$` - root object. Optional. When present, this component has to be at the beginning of the path.\n- `.(key expression)` or `[(key expression)]` - child objects that matches the given key.\n- `..(key expression)` - descendant objects that matches the given key.\n\n`(key expression)` above can be either of:\n\n- _integer_ - used to specify index in lists. Value can be negative, e.g. `-1` represents the last element.\n- _atom_ - starts with colon and can be quoted, e.g. `:atom`, `:\"quoted_atom\"`.\n  When `prefer_keys: :atom` option is given, preceding colon can be omitted.\n- _string_ - double-quoted. Double quotation can be omitted unless `prefer_keys: :atom` option is given.\n- _charlist_ - single-quoted.\n- _wildcard_ - `*`. Represents all the children.\n\n## Examples\n\n```elixir\n# string\niex\u003e Elixpath.query(%{:a =\u003e 1, \"b\" =\u003e 2}, ~S/.\"b\"/)\n{:ok, [2]}\n\n# you can use Elixpath.get! if you want only a single match\niex\u003e Elixpath.get!(%{:a =\u003e 1, \"b\" =\u003e 2}, \".*\")\n1\n\n# unquoted string\niex\u003e Elixpath.query(%{:a =\u003e 1, \"b\" =\u003e 2}, \".b\")\n{:ok, [2]}\n\n# no match\niex\u003e Elixpath.query(%{:a =\u003e 1, \"b\" =\u003e 2}, \".nonsense\")\n{:ok, []}\n\n# no match w/ get!\niex\u003e Elixpath.get!(%{:a =\u003e 1, \"b\" =\u003e 2}, \".nonsense\", _default = :some_default_value)\n:some_default_value\n\n# atom\niex\u003e Elixpath.query(%{:a =\u003e 1, \"b\" =\u003e 2}, \".:a\")\n{:ok, [1]}\n\n# integer\niex\u003e Elixpath.query(%{:a =\u003e [%{b: 2}, %{c: 3}]}, \".:a[-1]\")\n{:ok, [%{c: 3}]}\n\n# descendant\niex\u003e Elixpath.query(%{:a =\u003e [%{b: 2}, %{c: 3}]}, \"..:c\")\n{:ok, [3]}\n\n# wildcard\niex\u003e Elixpath.query(%{:a =\u003e [%{b: 2}, %{c: 3}]}, \".*.*.*\")\n{:ok, [2, 3]}\n\n# enable sigil_p/2, which parses Elixpath at compile time.\niex\u003e import Elixpath\niex\u003e Elixpath.query(%{:a =\u003e [%{b: 2}, %{c: 3}]}, ~p\".:a.1.:c\")\n{:ok, [3]}\n\n# path syntax error for normal string is detected at runtime.\niex\u003e Elixpath.query(%{:a =\u003e [%{b: 2}, %{c: 3}]}, \".:atom:syntax:error\")\n{:error, \"expected member_expression while processing path\"}\n\n# while sigil_p raises a compilation error:\n# iex\u003e Elixpath.query(%{:a =\u003e [%{b: 2}, %{c: 3}]}, ~p\".:atom:syntax:error\")\n# == Compilation error in file test/elixpath_test.exs ==\n# ** (Elixpath.Parser.ParseError) ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtannaan%2Felixpath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtannaan%2Felixpath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtannaan%2Felixpath/lists"}