{"id":18616720,"url":"https://github.com/sile/jlu","last_synced_at":"2025-06-15T20:12:21.318Z","repository":{"id":246841906,"uuid":"823382671","full_name":"sile/jlu","owner":"sile","description":"Command-line utilities for on-the-fly investigation of JSON Lines","archived":false,"fork":false,"pushed_at":"2024-07-04T10:25:40.000Z","size":38,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T07:12:46.516Z","etag":null,"topics":["command-line-tool","json","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/sile.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-07-02T23:57:38.000Z","updated_at":"2024-12-04T08:23:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"7995d095-a29e-4bef-b1df-7ca5802e0572","html_url":"https://github.com/sile/jlu","commit_stats":null,"previous_names":["sile/jlu"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fjlu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fjlu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fjlu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fjlu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sile","download_url":"https://codeload.github.com/sile/jlu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248325275,"owners_count":21084900,"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":["command-line-tool","json","rust"],"created_at":"2024-11-07T03:37:42.800Z","updated_at":"2025-04-11T01:32:06.323Z","avatar_url":"https://github.com/sile.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"jlu\n===\n\n[![jlu](https://img.shields.io/crates/v/jlu.svg)](https://crates.io/crates/jlu)\n[![Actions Status](https://github.com/sile/jlu/workflows/CI/badge.svg)](https://github.com/sile/jlu/actions)\n![License](https://img.shields.io/crates/l/jlu)\n\n```console\n$ jlu\nCommand-line utilities for on-the-fly investigation of JSON Lines\n\nUsage: jlu \u003cCOMMAND\u003e\n\nCommands:\n  count    Read JSON objects from stdin and count the occurrences of the values associated with the specified top-level member names\n  flatten  Read JSON values from stdin and convert each value into a flattened JSON object\n  names    Read JSON objects from stdin and output the unique member names for all top-level objects\n  rename   Read JSON objects from stdin and rename top-level member names that match a regular expression with a replacement string\n  table    Read JSON objects from stdin and create a markdown table\n  help     Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help     Print help\n  -V, --version  Print version\n```\n\nInstallation\n------------\n\nPlease execute the following command:\n```console\n$ cargo install jlu\n```\n\nIn addition, pre-built binaries for Linux and MacOS are available in [the releases page](https://github.com/sile/jlu/releases).\n\nCommand Examples\n----------------\n\n### `$ jlu flatten`\n\n```console\n$ jlu flatten --help\nRead JSON values from stdin and convert each value into a flattened JSON object\n\nUsage: jlu flatten\n\nOptions:\n  -h, --help  Print help\n\n$ jq . example0.json\n{\n  \"aaa\": 1,\n  \"bbb\": [\n    \"a\",\n    \"b\",\n    \"c\"\n  ],\n  \"ccc\": {\n    \"x\": 10,\n    \"y\": 20\n  }\n}\n\n$ cat example0.json | jlu flatten | jq .\n{\n  \"aaa\": 1,\n  \"bbb[0]\": \"a\",\n  \"bbb[1]\": \"b\",\n  \"bbb[2]\": \"c\",\n  \"ccc.x\": 10,\n  \"ccc.y\": 20\n}\n```\n\nNote that the following commands assume that the input JSON values are flat JSON objects.\n\n### `$ jlu names`\n\n```console\n$ jlu names --help\nRead JSON objects from stdin and output the unique member names for all top-level objects\n\nUsage: jlu names\n\nOptions:\n  -h, --help  Print help\n\n$ cat example0.json | jlu flatten | jlu names\n\"aaa\"\n\"bbb[0]\"\n\"bbb[1]\"\n\"bbb[2]\"\n\"ccc.x\"\n\"ccc.y\"\n```\n\n### `$ jlu rename`\n\n```console\n$ jlu rename --help\nRead JSON objects from stdin and rename top-level member names that match a regular expression with a replacement string.\n\nFor details about regular expressions and replacement strings, please refer to the documentation of the regex crate: https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all\n\nUsage: jlu rename \u003cREGEX\u003e \u003cREPLACEMENT\u003e\n\nArguments:\n  \u003cREGEX\u003e\n          Regular expression to match top-level member names\n\n  \u003cREPLACEMENT\u003e\n          String to replace the matched segment of the member names\n\nOptions:\n  -h, --help\n          Print help (see a summary with '-h')\n\n$ cat example0.json | jlu flatten | jlu rename '(.+)\\.' '' | jq .\n{\n  \"aaa\": 1,\n  \"bbb[0]\": \"a\",\n  \"bbb[1]\": \"b\",\n  \"bbb[2]\": \"c\",\n  \"x\": 10,\n  \"y\": 20\n}\n```\n\n### `$ jlu count`\n\n```console\n$ jlu count --help\nRead JSON objects from stdin and count the occurrences of the values associated with the specified top-level member names\n\nUsage: jlu count [NAMES]...\n\nArguments:\n  [NAMES]...  Names of the top-level members to count\n\nOptions:\n  -h, --help  Print help\n\n$ cat example1.json\n{\"level\":\"info\",\"msg\":\"Hello World!\"}\n{\"level\":\"error\",\"msg\":\"Hello Rust!\"}\n{\"level\":\"info\",\"msg\":\"Hello JSON!\"}\n\n$ cat example1.json | jlu count level | jq .\n{\n  \"error\": 1,\n  \"info\": 2\n}\n\n$ cat example1.json | jlu count level msg | jq .info\n{\n  \"Hello JSON!\": 1,\n  \"Hello World!\": 1\n}\n```\n\n### `$ jlu table`\n\n```console\n$ jlu table --help\nRead JSON objects from stdin and create a markdown table\n\nUsage: jlu table [OPTIONS] [COLUMN_NAMES]...\n\nArguments:\n  [COLUMN_NAMES]...  Names of object members to be included in the table\n\nOptions:\n  -s, --sort \u003cSORT\u003e\n          If specified, the table rows are sorted based on the member value associated with this name\n  -m, --max-column-chars \u003cMAX_COLUMN_CHARS\u003e\n          Maximum number of characters to display in a column [default: 50]\n  -h, --help\n          Print help\n\n$ cat example1.json | jlu table level msg --sort level\n| level | msg          |\n|-------|--------------|\n| error | Hello Rust!  |\n| info  | Hello World! |\n| info  | Hello JSON!  |\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsile%2Fjlu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsile%2Fjlu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsile%2Fjlu/lists"}