https://github.com/ausaf007/json-to-env
Simple bash script script to locally convert JSON files to .env format
https://github.com/ausaf007/json-to-env
bash cli environment-variables jq json
Last synced: over 1 year ago
JSON representation
Simple bash script script to locally convert JSON files to .env format
- Host: GitHub
- URL: https://github.com/ausaf007/json-to-env
- Owner: ausaf007
- License: mit
- Created: 2023-10-06T11:22:41.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-06T11:41:06.000Z (over 2 years ago)
- Last Synced: 2025-01-07T19:38:03.944Z (over 1 year ago)
- Topics: bash, cli, environment-variables, jq, json
- Language: Shell
- Homepage:
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# json_to_env
`json_to_env` is a simple bash script utility to locally convert JSON files into `.env` format.
## Requirements
- `jq`: This script uses jq to parse and convert the JSON data.
- Flat JSON Structure: The provided JSON file should have a flat structure. Nested JSON structures are not supported for conversion.
## Usage
```bash
./json_to_env.sh
```
- ``: The path to your source JSON file.
- ``: The path where you want the resulting .env file to be saved.
### Example:
```bash
./json_to_env.sh config.json config.env
```
## Installation
1. Clone this repository or download the `json_to_env.sh` file directly.
2. Provide execute permissions to the script:
```bash
chmod +x json_to_env.sh
```
3. Ensure `jq` is installed. If not, you can generally install it using package managers:
For Ubuntu/Debian:
```bash
sudo apt-get install jq
```
For macOS (using Homebrew):
```bash
brew install jq
```
For other distributions or platforms, please check the `jq` [official documentation](https://stedolan.github.io/jq/download/).
## Contributing
Feel free to fork this repository, make changes, and submit pull requests. Any kind of contributions are welcome!
## License
[MIT](https://github.com/ausaf007/json-to-env/blob/master/LICENSE)