json_to_env
is a simple bash script utility to locally convert JSON files into .env
format.
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.
./json_to_env.sh <input_json_file> <output_env_file>
<input_json_file>
: The path to your source JSON file.<output_env_file>
: The path where you want the resulting .env file to be saved.
./json_to_env.sh config.json config.env
- Clone this repository or download the
json_to_env.sh
file directly. - Provide execute permissions to the script:
chmod +x json_to_env.sh
- Ensure
jq
is installed. If not, you can generally install it using package managers:
For Ubuntu/Debian:
sudo apt-get install jq
For macOS (using Homebrew):
brew install jq
For other distributions or platforms, please check the jq
official documentation.
Feel free to fork this repository, make changes, and submit pull requests. Any kind of contributions are welcome!