json-to-env-ks
v1.0.2
Published
A simple CLI tool to convert JSON files to .env format
Downloads
197
Maintainers
Readme
json-to-env-ks (By Krushang)
🛠 Easily Convert JSON Files to .env Format!
⭐ If this tool helps you, consider giving it a star on GitHub!
Read Docs
🚀 Introduction
json-to-env-ks
is a simple yet powerful CLI tool that automatically converts JSON files to .env format. It eliminates the need for manual conversion, saving developers time and effort. Simply run a command, and your .env
file will be generated instantly!
Why use json-to-env-ks
?
- 📌 Fast & Efficient – Converts JSON to
.env
instantly. - 📌 No Manual Work – Avoid human errors in converting configurations.
- 📌 Works with Any Project – Supports Node.js, React.js, Next.js, Express.js, and more.
- 📌 Lightweight & Easy to Use – No complicated setup required.
📥 Installation
[!IMPORTANT] > It's crucial to install it globally so that you can use it from any directory in your terminal
Install globally:
npm install -g json-to-env-ks
Use without installation (via npx
):
npx json-to-env-ks "<json-file-path>" "<output-env-file-path>"
📌 How to Use
Basic Usage:
json-to-env-ks "<json-file-path>" "<output-env-file-path>"
Arguments:
- First argument – Path to the JSON file you want to convert.
- Second argument – Path where you want to save the
.env
file.
[!TIP] Wrap file paths in
"quotes"
to handle folders with spaces.
📖 Example Usage
Input (config.json
):
{
"DB_HOST": "localhost",
"DB_USER": "root",
"DB_PASS": "password"
}
Command:
json-to-env-ks "config.json" ".env"
Output (.env
):
DB_HOST=localhost
DB_USER=root
DB_PASS=password
🛠 Features
✔️ Converts JSON to .env
quickly
✔️ Handles nested JSON structures gracefully
✔️ Supports various frameworks like Node.js, React.js, Next.js, Express.js
✔️ Lightweight and dependency-efficient
✔️ Easy to install and use
✔️ Automatically detects and preserves existing .env
file structure
✔️ User-friendly CLI interface
✅ Supported Platforms
- [x] Node.js (Tested)
- [x] React.js (Tested)
- [x] Next.js (Tested)
- [x] Express.js (Tested)
- [x] Any Project using
.env
files
❌ Not yet supported:
- YAML to
.env
conversion - Direct
.env
encryption
⚠️ Troubleshooting
1. Command Not Found?
If you installed it globally but get a "command not found" error, try:
npx json-to-env-ks "config.json" ".env"
Or, ensure your global npm binaries are in your system path:
echo $PATH
2. Permission Issues?
Try running the command with administrator privileges:
sudo npm install -g json-to-env-ks
3. Unexpected Output?
Ensure your JSON file is correctly formatted.
⭐ Contribute & Support
- If you found this package helpful, please ⭐ star the GitHub repository!
- Issues and feature requests are welcome!
- Follow me on GitHub: Krushang-07
🚀 Happy Coding! 😃