{"id":15422552,"url":"https://github.com/heaths/jq","last_synced_at":"2026-03-19T07:27:15.067Z","repository":{"id":238051599,"uuid":"795769131","full_name":"heaths/jq","owner":"heaths","description":"jq modules","archived":false,"fork":false,"pushed_at":"2025-09-20T18:13:08.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-20T20:26:29.326Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"jq","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/heaths.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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-05-04T02:28:40.000Z","updated_at":"2025-09-20T18:13:11.000Z","dependencies_parsed_at":"2024-05-04T03:25:35.539Z","dependency_job_id":"be41d504-ce61-4231-8fb0-1dda01855d94","html_url":"https://github.com/heaths/jq","commit_stats":null,"previous_names":["heaths/jq"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/heaths/jq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heaths%2Fjq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heaths%2Fjq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heaths%2Fjq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heaths%2Fjq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heaths","download_url":"https://codeload.github.com/heaths/jq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heaths%2Fjq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28787129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T13:55:28.044Z","status":"ssl_error","status_checked_at":"2026-01-26T13:55:26.068Z","response_time":59,"last_error":"SSL_read: 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":[],"created_at":"2024-10-01T17:38:54.903Z","updated_at":"2026-01-26T20:10:52.968Z","avatar_url":"https://github.com/heaths.png","language":"jq","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jq Modules\n\nThese are handy [jq] modules that can be imported and used in your jq expressions e.g.,\n\n```bash\necho '[{\"num\":1,\"desc\":\"one\"},{\"num\":2,\"desc\":\"two\"}]' |\n  jq -r 'include \"heaths/format\"; table'\n```\n\n## Install\n\nYou can install this wherever you like, but to import it without specifying the whole path,\nyou should clone this repo into `~/.jq`:\n\n```bash\nmkdir -p ~/.jq\ngit clone https://github.com/heaths/jq ~/.jq/heaths\n```\n\n## Functions\n\n### table\n\n`table` formats an array of objects as tab-separated values you can use with `column -t` or write to a `.csv` file.\nThe first row is used to identify scalar values' key names used for the header row and to select the same values for every row.\n\n`table` automatically flattens input so you do not need to pass `--slurp` or `-s`.\n\n```bash\necho '[{\"num\":1,\"desc\":\"one\",\"sib\":[0,2]},{\"num\":2,\"desc\":\"two\",\"sib\":[1,3]}]' |\n  jq -r 'include \"heaths/format\"; table'\n```\n\n```text\nnum     desc\n1       one\n2       two\n```\n\n### table_rows\n\n`table_rows` works exactly like `table` but without printing the header row. The first row is still used to identity scalar values.\n\n```bash\necho '[{\"num\":1,\"desc\":\"one\",\"sib\":[0,2]},{\"num\":2,\"desc\":\"two\",\"sib\":[1,3]}]' |\n  jq -r 'include \"heaths/format\"; table_rows'\n```\n\n```text\n1       one\n2       two\n```\n\n### toversion\n\n`toversion` parses [semantic versions](https://semver.org) into an array suitable for sorting.\n\n```bash\ncat \u003c\u003c'EOF' | jq -r 'include \"heaths/version\"; . | sort_by(toversion)'\n[\n    \"0.1.0\",\n    \"1.2.3-beta1\",\n    \"2.4-beta.0\",\n    \"1.2.3\",\n    \"1.2.3-beta.1\",\n    \"1.2.3-beta+abcd1234\",\n    \"1.2.3-alpha\",\n    \"0.2.0\",\n    \"2.3.4\"\n]\nEOF\n```\n\n```text\n[\n  \"0.1.0\",\n  \"0.2.0\",\n  \"1.2.3-alpha\",\n  \"1.2.3-beta+abcd1234\",\n  \"1.2.3-beta.1\",\n  \"1.2.3-beta1\",\n  \"1.2.3\",\n  \"2.3.4\",\n  \"2.4-beta.0\"\n]\n```\n\nYou can also use it to get the latest version using `max_by`.\n\n```bash\ncat \u003c\u003c'EOF' | jq -r 'include \"heaths/version\"; . | max_by(toversion)'\n[\n  \"1.0.0\",\n  \"0.1.0\",\n  \"1.0.0-beta.0\"\n]\nEOF\n```\n\n```text\n\"1.0.0\"\n```\n\n### release\n\n`release` and `release($pre)` can be used to filter versions. `$pre` is `false` by default and will only show release semvers - those without patch metdata.\n\n```bash\nversions='[\"0.1.0\",\"1.0.0-beta.1\",\"0.2.0\",\"1.0.0\"]'\necho $versions | jq -r 'import \"heaths/version\" as v; .[] | select(v::toversion | v::release)'\n```\n\n```text\n\"0.1.0\"\n\"0.2.0\"\n\"1.0.0\"\n```\n\n```bash\necho $versions | jq -r 'import \"heaths/version\" as v; .[] | select(v::toversion | v::release(true))'\n```\n\n```text\n\"0.1.0\"\n\"1.0.0-beta.1\"\n\"0.2.0\"\n\"1.0.0\"\n```\n\n## License\n\nThis project is licensed under the [MIT license](LICENSE.txt).\n\n[jq]: https://jqlang.github.io/jq\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheaths%2Fjq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheaths%2Fjq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheaths%2Fjq/lists"}