npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

json-to-env-ks

v1.0.2

Published

A simple CLI tool to convert JSON files to .env format

Downloads

197

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:

  1. First argument – Path to the JSON file you want to convert.
  2. 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! 😃