{"id":13539494,"url":"https://github.com/tj-actions/json2file","last_synced_at":"2025-04-12T06:17:31.052Z","repository":{"id":64939020,"uuid":"568520616","full_name":"tj-actions/json2file","owner":"tj-actions","description":"Simplifies the process of serializing JSON data to a file.","archived":false,"fork":false,"pushed_at":"2025-03-23T12:46:48.000Z","size":591,"stargazers_count":5,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T19:21:15.127Z","etag":null,"topics":["actions","github-actions","json","json2json","json2text","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/tj-actions.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":"CONTRIBUTING.md","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},"funding":{"github":["jackton1"],"patreon":null,"open_collective":"tj-actions","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":[]}},"created_at":"2022-11-20T19:33:52.000Z","updated_at":"2025-03-23T12:46:45.000Z","dependencies_parsed_at":"2024-12-18T16:21:26.974Z","dependency_job_id":"9b716032-455b-409c-ae71-846f80d9a4d0","html_url":"https://github.com/tj-actions/json2file","commit_stats":{"total_commits":471,"total_committers":6,"mean_commits":78.5,"dds":0.524416135881104,"last_synced_commit":"aa49f03794aa53ebe35ff716a1fd9bdb795c4ea9"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":"tj-actions/docker-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj-actions%2Fjson2file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj-actions%2Fjson2file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj-actions%2Fjson2file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj-actions%2Fjson2file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tj-actions","download_url":"https://codeload.github.com/tj-actions/json2file/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514709,"owners_count":21117013,"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":["actions","github-actions","json","json2json","json2text","rust"],"created_at":"2024-08-01T09:01:26.688Z","updated_at":"2025-04-12T06:17:31.006Z","avatar_url":"https://github.com/tj-actions.png","language":"Rust","funding_links":["https://github.com/sponsors/jackton1","https://opencollective.com/tj-actions","https://www.buymeacoffee.com/jackton1"],"categories":["Rust"],"sub_categories":[],"readme":"[![Crates.io](https://img.shields.io/crates/v/json2file)](https://crates.io/crates/json2file)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/b60a9e369c774e11a813baa11362b99d)](https://app.codacy.com/gh/tj-actions/json2file/dashboard?utm_source=gh\\\u0026utm_medium=referral\\\u0026utm_content=\\\u0026utm_campaign=Badge_grade)\n[![codecov](https://codecov.io/gh/tj-actions/json2file/branch/main/graph/badge.svg?token=FALQKDPDP2)](https://codecov.io/gh/tj-actions/json2file)\n[![CI](https://github.com/tj-actions/json2file/workflows/CI/badge.svg)](https://github.com/tj-actions/json2file/actions?query=workflow%3ACI)\n[![Update release version.](https://github.com/tj-actions/json2file/actions/workflows/sync-release-version.yml/badge.svg)](https://github.com/tj-actions/json2file/actions/workflows/sync-release-version.yml)\n[![Public workflows that use this action.](https://img.shields.io/endpoint?url=https%3A%2F%2Fused-by.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3Dtj-actions%2Fjson2file%26badge%3Dtrue)](https://github.com/search?o=desc\\\u0026q=tj-actions+json2file+language%3AYAML\\\u0026s=\\\u0026type=Code)\n\n[![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?logo=ubuntu\\\u0026logoColor=white)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)\n[![Mac OS](https://img.shields.io/badge/mac%20os-000000?logo=macos\\\u0026logoColor=F0F0F0)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)\n[![Windows](https://img.shields.io/badge/Windows-0078D6?logo=windows\\\u0026logoColor=white)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)\n\n# json2file\n\nSimplifies the process of serializing JSON data to a file.\n\n## Usage\n\n```yaml\n...\n    - name: Set output\n      id: set-output\n      run: |\n        echo \"color=green\" \u003e\u003e $GITHUB_OUTPUT\n\n    - name: Generate file output from json\n      uses: tj-actions/json2file@v1\n      with:\n        directory: 'output'\n        outputs:  ${{ toJSON(steps.set-output.outputs) }}\n        keys: 'color'\n        extension: 'txt'\n...\n```\n\nThe above example will create a file named `color.txt` in the `output` directory with the contents `green`.\n\n```bash\n$ cat ./output/color.txt\ngreen\n```\n\n## Inputs\n\n\u003c!-- AUTO-DOC-INPUT:START - Do not remove or modify this section --\u003e\n\n|                                        INPUT                                        |  TYPE  | REQUIRED |       DEFAULT       |                          DESCRIPTION                          |\n|-------------------------------------------------------------------------------------|--------|----------|---------------------|---------------------------------------------------------------|\n|              \u003ca name=\"input_bin_path\"\u003e\u003c/a\u003e[bin\\_path](#input_bin_path)               | string |  false   |                     |                      Path to the binary                       |\n|             \u003ca name=\"input_directory\"\u003e\u003c/a\u003e[directory](#input_directory)             | string |   true   | `\".github/outputs\"` |                     Directory to write to                     |\n|             \u003ca name=\"input_extension\"\u003e\u003c/a\u003e[extension](#input_extension)             | string |  false   |       `\"txt\"`       |    File extension to use, possible \u003cbr\u003evalues: txt, json      |\n|                    \u003ca name=\"input_keys\"\u003e\u003c/a\u003e[keys](#input_keys)                     | string |   true   |                     |   List of Keys to read \u003cbr\u003efrom the `outputs` JSON string     |\n|                \u003ca name=\"input_outputs\"\u003e\u003c/a\u003e[outputs](#input_outputs)                | string |   true   |                     |                          JSON string                          |\n| \u003ca name=\"input_skip_missing_keys\"\u003e\u003c/a\u003e[skip\\_missing\\_keys](#input_skip_missing_keys) | string |  false   |      `\"false\"`      | Skip missing keys not found \u003cbr\u003ein the `outputs` JSON string  |\n\n\u003c!-- AUTO-DOC-INPUT:END --\u003e\n\n## Installation\n\nTo install `json2file`, open a terminal window (Command Prompt or PowerShell on Windows) and run the following command:\n\n```shell\ncargo install json2file\n```\n\n### Building from Source\n\nIf you prefer to build from the source, follow these steps:\n\n```shell\ngit clone https://github.com/tj-actions/json2file\ncd json2file\ncargo build --release\n```\n\n## CLI Reference\n\nRun `json2file --help` for more information.\n\n```bash\n$ json2file --help\nGenerate file output from JSON\n\nUsage: json2file [OPTIONS] --keys \u003cKEYS\u003e --outputs \u003cOUTPUTS\u003e --directory \u003cDIRECTORY\u003e\n\nOptions:\n  -k, --keys \u003cKEYS\u003e            Space delimited list of keys to extract from the JSON output\n  -o, --outputs \u003cOUTPUTS\u003e      The JSON output to use\n  -d, --directory \u003cDIRECTORY\u003e  The directory to output the files to\n  -s, --skip-missing-keys      Skip missing keys\n  -e, --extension \u003cEXTENSION\u003e  The extension to use for the files [default: txt] [possible values: txt, json, csv]\n  -v, --verbose                \n  -h, --help                   Print help\n  -V, --version                Print version\n```\n\n### Example\n\nRun\n\n```bash\njson2file --keys=\"foo bar\" --outputs=\"{\\\"foo\\\": \\\"value1\\\", \\\"bar\\\": \\\"value2\\\"}\" --directory=/tmp --extension=txt\n```\n\nThis creates two files with the following contents:\n\n`foo.txt`\n\n```txt\nvalue1\n```\n\n`bar.txt`\n\n```txt\nvalue2\n```\n\n*   Free software: [MIT license](LICENSE)\n\nIf you feel generous and want to show some extra appreciation:\n\n[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee]\n\n[buymeacoffee]: https://www.buymeacoffee.com/jackton1\n\n[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\n\n## Credits\n\nThis package was created with [Cookiecutter](https://github.com/cookiecutter/cookiecutter) using [cookiecutter-action](https://github.com/tj-actions/cookiecutter-action)\n\n## Report Bugs\n\nReport bugs at https://github.com/tj-actions/json2file/issues.\n\nIf you are reporting a bug, please include:\n\n*   Your operating system name and VERSION.\n*   Any details about your workflow that might be helpful in troubleshooting.\n*   Detailed steps to reproduce the bug.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftj-actions%2Fjson2file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftj-actions%2Fjson2file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftj-actions%2Fjson2file/lists"}