Monu Tools

ENV 與 JSON 轉換器

在瀏覽器中將 .env 檔案轉換為 JSON,或將 JSON 轉換回 .env,支援雙向轉換。

如何使用 ENV / JSON

  1. 01

    選擇轉換方向:.env 轉 JSON,或 JSON 轉 .env。

  2. 02

    貼上 .env 內容或 JSON 物件。

  3. 03

    複製結果,或互換進行反向轉換。

Convert .env and JSON

A two-way converter between .env files and JSON. Turn a .env file into a JSON object to inspect or edit it, or turn JSON back into a valid .env file, handling comments, the export prefix and quoted values.

Converting to JSON is useful for bulk-editing config, diffing two environments, or feeding settings into a tool that expects JSON; converting back produces a ready-to-use .env.

Because .env files hold secrets, privacy matters: the conversion runs entirely in your browser, so your environment variables and any keys in them never leave your device.

What a .env file is

A .env file is the simple KEY=value list that apps load to configure themselves, database URLs, API keys, feature flags, kept out of the code and out of version control. It is the standard way to separate configuration from an application.

How reading a .env works

When reading a .env, comment lines starting with # and blank lines are ignored, an optional export prefix is removed, and surrounding quotes are stripped from values, so the JSON you get is clean and exactly the key-value pairs.

Values with spaces on the way back

When writing a .env, values that contain spaces or special characters are wrapped in double quotes so they parse correctly in a shell or a dotenv loader, which avoids a common source of broken configuration.

常見問題

如何處理注解和引號?

以 # 開頭的注解行和空行會被忽略,可選的 export 前綴會被移除,值周圍的引號會被去除。

包含空格的值怎麼辦?

寫入 .env 時,包含空格或特殊字元的值會用雙引號括起來,以確保正確解析。

我的 .env 會上傳到任何地方嗎?

不會。轉換完全在瀏覽器中執行,您的環境變數永遠不會離開裝置。

嵌入此工具

將此工具加入你自己的網站。複製下方的程式碼片段,它會自動保持最新。

<iframe src="https://monu.tools/embed/zh-Hant/env-json-converter" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>

相關工具