完全在浏览器中,将 .env 文件转为 JSON,也可将 JSON 转回 .env,双向均可。
如何使用 ENV / JSON
选择方向:.env 转 JSON 或 JSON 转 .env。
粘贴你的 .env 内容或一个 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.
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.
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.
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 时,包含空格或特殊字符的值会用双引号包裹,以便正确解析。
不会。转换完全在你的浏览器中运行,因此你的环境变量永远不会离开你的设备。
嵌入此工具
将此工具添加到你自己的网站。复制下方代码片段即可,它会自动保持最新。
<iframe src="https://monu.tools/embed/zh/env-json-converter" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>相关工具