{"id":22870926,"url":"https://github.com/percona-lab/text2json","last_synced_at":"2025-03-31T11:27:15.337Z","repository":{"id":68884215,"uuid":"98893756","full_name":"Percona-Lab/text2json","owner":"Percona-Lab","description":"POC for a text (pt-summary / pt-mysql-summary) reports to json converter","archived":false,"fork":false,"pushed_at":"2017-07-31T14:32:42.000Z","size":2,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-06T16:59:09.247Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Percona-Lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2017-07-31T13:51:43.000Z","updated_at":"2021-08-30T07:26:12.000Z","dependencies_parsed_at":"2023-06-04T22:15:47.027Z","dependency_job_id":null,"html_url":"https://github.com/Percona-Lab/text2json","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Percona-Lab%2Ftext2json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Percona-Lab%2Ftext2json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Percona-Lab%2Ftext2json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Percona-Lab%2Ftext2json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Percona-Lab","download_url":"https://codeload.github.com/Percona-Lab/text2json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246460591,"owners_count":20781155,"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":[],"created_at":"2024-12-13T13:16:36.603Z","updated_at":"2025-03-31T11:27:15.332Z","avatar_url":"https://github.com/Percona-Lab.png","language":"Go","readme":"# text2json\nPOC for a text (pt-summary / pt-mysql-summary) reports to json converter\n\nThe idea is to be able to convert the text output of any program.  \nCurrently this program implements these filters:  \n- All lines having the form `# title here ####...` are considered titles and the title is being used as the key of a json field.\n- All lines having the form `left string | right string` are considered a hash entry where the `left string` is the hash key and \n`right string` is the hash value\n- If a line cannot be parsed as a title nor a hash, it will be added as a row in a strings array.\n  \n### Example\n   \n```\n# MySQL Executable ###########################################\n       Path to executable | /home/karl/mysql/my-5.6.36/bin/mysqld\n              Has symbols | Yes\n\n# Status Counters (Wait 10 Seconds) ##########################\nVariable                                Per day  Per second     11 secs\nAborted_connects                              2\nBytes_received                            30000                     350\nBytes_sent                               450000           4        2000\nCom_select                                  150                       1\nCom_show_binlogs                              5\nCom_show_databases                            5\n\n```\n  \nTis block:  \n\n```\n# MySQL Executable ###########################################\n       Path to executable | /home/karl/mysql/my-5.6.36/bin/mysqld\n              Has symbols | Yes\n```\nwill be parsed as a hash:\n```\n\"MySQL Executable\": {\n       \"Path to executable:\": \"/home/karl/mysql/my-5.6.36/bin/mysqld\",\n       \"Has symbols\": \"Yes\",\n}\n```\n  \nand this other block:  \n```\n# Status Counters (Wait 10 Seconds) ##########################\nVariable                                Per day  Per second     11 secs\nAborted_connects                              2\nBytes_received                            30000                     350\nBytes_sent                               450000           4        2000\nCom_select                                  150                       1\nCom_show_binlogs                              5\nCom_show_databases                            5\n```\nwill be parsed as an array:\n```\n\"Status Counters (Wait 10 Seconds)\": [\n\"Variable                                Per day  Per second     11 secs\",\n\"Aborted_connects                              2\",\n\"Bytes_received                            30000                     350\",\n\"Bytes_sent                               450000           4        2000\",\n\"Com_select                                  150                       1\",\n\"Com_show_binlogs                              5\",\n\"Com_show_databases                            5\"\n]\n```\n  \nThe resulting json is:\n\n```\n{\n   \"MySQL Executable\": {\n          \"Path to executable:\": \"/home/karl/mysql/my-5.6.36/bin/mysqld\",\n          \"Has symbols\": \"Yes\",\n   },\n   \"Status Counters (Wait 10 Seconds)\": [\n   \"Variable                                Per day  Per second     11 secs\",\n   \"Aborted_connects                              2\",\n   \"Bytes_received                            30000                     350\",\n   \"Bytes_sent                               450000           4        2000\",\n   \"Com_select                                  150                       1\",\n   \"Com_show_binlogs                              5\",\n   \"Com_show_databases                            5\"\n   ]\n}\n```\n  \n## Usage\n\n`text2json [filename]`  \n  \nIf no file name was specified, it reads from STADIN so you can `|` it to any command.  \n  \n### Examples\n```\npt-summary | text2json\n```  \n```\npt-summary | text2json \u003e pt-summary.json\n```\n```\npt-summary \u003e pt-summary.txt\ntext2json pt-summary.txt\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpercona-lab%2Ftext2json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpercona-lab%2Ftext2json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpercona-lab%2Ftext2json/lists"}