{"id":22863819,"url":"https://github.com/nilsding/rj","last_synced_at":"2025-10-25T09:32:44.642Z","repository":{"id":44353179,"uuid":"511945589","full_name":"nilsding/rj","owner":"nilsding","description":"a Ruby command-line JSON processor","archived":false,"fork":false,"pushed_at":"2023-06-06T18:57:23.000Z","size":164,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-05T02:54:33.576Z","etag":null,"topics":["json","mruby","ruby"],"latest_commit_sha":null,"homepage":"https://nilsding.github.io/rj/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nilsding.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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":"2022-07-08T15:40:35.000Z","updated_at":"2022-08-18T11:14:59.000Z","dependencies_parsed_at":"2025-05-03T00:26:23.732Z","dependency_job_id":"bd7ce285-6b19-451b-bf29-a912f5b41855","html_url":"https://github.com/nilsding/rj","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/nilsding/rj","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsding%2Frj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsding%2Frj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsding%2Frj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsding%2Frj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nilsding","download_url":"https://codeload.github.com/nilsding/rj/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsding%2Frj/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261967126,"owners_count":23237662,"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":["json","mruby","ruby"],"created_at":"2024-12-13T11:17:36.760Z","updated_at":"2025-10-25T09:32:44.539Z","avatar_url":"https://github.com/nilsding.png","language":"Ruby","readme":"# rj\n\na tool that's like `jq` but uses Ruby expressions\n\n## Usage\n\n```sh\n# get the first element of an array (Enumerable#first)\ntool_that_emits_json | rj '.first'\n\n# get the 3rd element (Array#[])\ntool_that_emits_json | rj '[2]'\n\n# get specific fields (Hash#slice)\ntool_that_emits_json | rj '.first.slice(\"foo\", \"bar\")'\n\n# or map them yourself, the second expression will be applied to the result\n# of the first.  'item' is the special variable that holds the previous\n# result\n# this also demonstrates the usage of Hash#dig to fetch nested elements\ntool_that_emits_json | rj '.first' '{ one: item[\"foo\"], two: item.dig(\"bar\", \"name\") }'\n\n# same as above, but for all elements (Enumerable#map)\ntool_that_emits_json | rj '.map { |item| { one: item[\"foo\"], two: item.dig(\"bar\", \"name\") } }'\n\n# instead of `[]` and `dig` you can access an object's fields like methods\n# too.\n# this only works with keys that aren't already methods (e.g. `first`, `dig`,\n# `slice`, ...), and only on objects -- arrays need to be accessed like '[0]'.\ntool_that_emits_json | rj '.map { |item| { one: item.foo, two: item.bar.name } }'\n```\n\n## Requirements\n\nfor building:\n- CMake\n- Ruby 2.5 or later\n- [whatever else mruby 3.2.0 needs][mruby_deps] :^)\n\n## Building\n\n```sh\n# configure it\ncmake --preset dev\n\n# compile it\ncmake --build --preset dev\n\n# test it\nruby ./test/rj_test.rb\n\n# run it\n./build/src/rj\n```\n\n[mruby_deps]: https://github.com/mruby/mruby/blob/3.2.0/doc/guides/compile.md#prerequisites\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilsding%2Frj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnilsding%2Frj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilsding%2Frj/lists"}