{"id":15089139,"url":"https://github.com/giladbarnea/to","last_synced_at":"2026-02-08T07:35:50.652Z","repository":{"id":250686413,"uuid":"835146304","full_name":"giladbarnea/to","owner":"giladbarnea","description":"A simple CLI tool to convert and diff between JSON, YAML, TOML, JSON5 and Python collections.","archived":false,"fork":false,"pushed_at":"2024-12-04T14:53:31.000Z","size":118,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T21:53:01.900Z","etag":null,"topics":["conversion","data","data-conversion","json","json5","parser","script","terminal","toml","yaml"],"latest_commit_sha":null,"homepage":"","language":"Python","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/giladbarnea.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-29T08:54:48.000Z","updated_at":"2024-12-04T14:54:58.000Z","dependencies_parsed_at":"2024-07-29T13:10:31.691Z","dependency_job_id":"d8aa88c9-ffbd-45a4-ae4a-88e7ecbf3e69","html_url":"https://github.com/giladbarnea/to","commit_stats":{"total_commits":6,"total_committers":2,"mean_commits":3.0,"dds":"0.16666666666666663","last_synced_commit":"e33f99929ffa8f4af87aa2fcec18daa13c17f56c"},"previous_names":["giladbarnea/to"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giladbarnea%2Fto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giladbarnea%2Fto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giladbarnea%2Fto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giladbarnea%2Fto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giladbarnea","download_url":"https://codeload.github.com/giladbarnea/to/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487733,"owners_count":21112188,"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":["conversion","data","data-conversion","json","json5","parser","script","terminal","toml","yaml"],"created_at":"2024-09-25T08:41:04.365Z","updated_at":"2026-02-08T07:35:45.633Z","avatar_url":"https://github.com/giladbarnea.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# to\n\nCLI \u0026 Python package to convert or diff between JSON, YAML, TOML, JSON5 and literal Python collections.\n\n## Examples\n\nGiven a json file `example.json`:\n\n```json\n{\n  \"The Great Gatsby\": {\n    \"title\": \"The Great Gatsby\",\n    \"author\": \"F. Scott Fitzgerald\",\n    \"year\": 1925,\n    \"null_example\": null,\n    \"recommended\": true,\n    \"genres\": [\"Novel\", \"Fiction\"]\n  }\n}\n```\n\n### `to convert -f yaml`\n    $ to.py convert example.json -f yaml\n\n![json-to-yaml-example.png](docs/json-to-yaml-example.png)\n\n### `--clean` `--pretty` options\n\n    $ to.py convert example.json -f toml --clean --pretty\nThe `--clean` flag removes the `null_example` key with a `null` value.\n\nThe `--pretty` flag formats the output and prints it with syntax highlighting with `rich`.\n\n\n![json-to-toml-clean-pretty-example.png](/docs/json-to-toml-clean-pretty-example.png)\n\n## Usage\n\n### to.py\n```\nusage: to.py [-h] {convert,diff} ...\n\nConvert or diff between JSON, YAML, TOML, JSON5 and literal Python collections.\n\npositional arguments:\n  {convert,diff}\n    convert       Convert between different formats.\n    diff          Convert two files or data to FORMAT, then diff the result.\n\noptions:\n  -h, --help      show this help message and exit\n```\n———————\n\n#### `to convert`\n```\nusage: to.py convert [-h] -f {json,json5,toml,yaml} [-o OUTPUT] [--width WIDTH] [--sort-keys] [--clean] [-p] [input]\n\npositional arguments:\n  input                 Input string, file path, '-' for stdin. Can be omitted if piping data into the script (default: -)\n\noptions:\n  -h, --help            show this help message and exit\n  -f {json,json5,toml,yaml}, --format {json,json5,toml,yaml}\n                        Output format (default: None)\n  -o OUTPUT, --output OUTPUT\n                        Output file path or 'stdout' for standard output (default) (default: stdout)\n  --width WIDTH         Width for yaml output (default: 120) (default: 120)\n  --sort-keys           Sort keys in the output (default: True) (default: True)\n  --clean               Clean the output before writing (default: False)\n  -p, --pretty          Pretty print the output (default: False)\n```\n———————\n\n#### `to diff`\n```\nusage: to.py diff [-h] [-o OUTPUT_OR_TOOL] -f {json,json5,toml,yaml} [-q] [--ignore-order] [--ignore-empty] [--ignore-space] input1 input2\n\npositional arguments:\n  input1                Input string, file path, '-' for stdin.\n  input2                Input string, file path, '-' for stdin.\n\noptions:\n  -h, --help            show this help message and exit\n  -o OUTPUT_OR_TOOL, --output OUTPUT_OR_TOOL\n                        Choices: an output file path, or diff, delta, code, pycharm. If an output file path: write the output of coreutils 'diff' to this path. 'diff': print the output of coreutils' diff to\n                        stdout (default). A diff program — 'delta', 'code' or 'pycharm': view the diff with the respective tool. (default: diff)\n  -f {json,json5,toml,yaml}, --format {json,json5,toml,yaml}\n                        Convert inputs to this format before diffing. (default: None)\n  -q, --quiet           Do not print the diff to stdout, only return 0 for no difference, 1 for difference. (default: False)\n  --ignore-order        Ignore order of keys when diffing. (default: False)\n  --ignore-empty        Do not count a missing key as different from an empty value. (default: False)\n  --ignore-space        Ignore differences in whitespace. (default: False)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiladbarnea%2Fto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiladbarnea%2Fto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiladbarnea%2Fto/lists"}