{"id":15883686,"url":"https://github.com/0xch4z/selectr","last_synced_at":"2025-04-02T06:13:00.454Z","repository":{"id":57542849,"uuid":"269472081","full_name":"0xch4z/selectr","owner":"0xch4z","description":"Select values from objects/arrays with key-path notation.","archived":false,"fork":false,"pushed_at":"2023-03-01T21:35:10.000Z","size":57,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-26T13:50:37.341Z","etag":null,"topics":["go","golang","interpreter","parser"],"latest_commit_sha":null,"homepage":"","language":"Go","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/0xch4z.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":"2020-06-04T21:47:18.000Z","updated_at":"2023-08-17T23:54:22.000Z","dependencies_parsed_at":"2024-10-27T15:13:23.117Z","dependency_job_id":"e3424549-05a9-41c5-b3cc-da27477776dc","html_url":"https://github.com/0xch4z/selectr","commit_stats":{"total_commits":28,"total_committers":3,"mean_commits":9.333333333333334,"dds":0.1428571428571429,"last_synced_commit":"132cbe4ee348762052840333ce199c4a9d7e730b"},"previous_names":["charliekenney23/selectr"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xch4z%2Fselectr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xch4z%2Fselectr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xch4z%2Fselectr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xch4z%2Fselectr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xch4z","download_url":"https://codeload.github.com/0xch4z/selectr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246763945,"owners_count":20829799,"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":["go","golang","interpreter","parser"],"created_at":"2024-10-06T04:23:56.880Z","updated_at":"2025-04-02T06:13:00.440Z","avatar_url":"https://github.com/0xch4z.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# selectr [![GoDoc][godoc-badge]][godoc] ![test][test-badge]\n\n\u003e Select values from objects/arrays with key-path notation.\n\n## Key-path notation\n\nKey-path notation is a simple format for describing how to traverse data structures. It's very similar to C languages, but with limitations. See the [reference document](docs/key-path-notation.md) for more information.\n\n## Usage\n\n```go\nm := map[string]interface{}{\n    \"foo\": map[string]interface{}{\n        \"bar\": []interface{}{\n            1,\n            2,\n            3,\n        },\n    },\n}\n\nsel, _ := selectr.Parse(\".foo\")\nsel.Resolve(m) // =\u003e map[string]interface{}{\"bar\": []interface{}{1, 2, 3}}\n\nsel, _ = selectr.Parse(\".foo.bar\")\nsel.Resolve(m) // =\u003e []interface{}{1, 2, 3}\n\nsel, _ = selectr.Parse(\".foo.bar[1]\")\nsel.Resolve(m) // =\u003e 2\n```\n\n## Use cases\n\n- Referencing a dynamic value in a JSON/YAML file:\n\n  Consider you maintain a program that allows users to reference arbitrary values, and one strategy of resolving a value is referencing a symbol in a JSON file.\n\n  ```json\n  # example.json\n  {\n      \"accounts\": [{\n          \"id\": 123,\n          \"name\": \"main\"\n      }]\n  }\n  ```\n\n  The end-user references `example.json` with the selectr `.accounts[0].name`.\n\n  ```go\n  jsonBytes, _ := os.Open(fileName)\n\n  var m map[string]interface{}\n  json.Unmarshal(jsonBytes, \u0026m)\n\n  sel, _ := selectr.Parse(selectrString)\n  val := sel.Resolve(m)\n  ```\n\n  The `val` is resolved to `\"main\"`.\n\n- Import dynamic values from dynamic data files.\n\n[test-badge]: https://github.com/0xch4z/selectr/workflows/test/badge.svg\n[godoc-badge]: https://godoc.org/github.com/0xch4z/selectr?status.svg\n[godoc]: https://godoc.org/github.com/0xch4z/selectr\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xch4z%2Fselectr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xch4z%2Fselectr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xch4z%2Fselectr/lists"}