Text & Data

.env to JSON / YAML Converter

Convert a dotenv (.env) file to JSON or YAML and back again — handles quoted values, comments and nested keys. Great for Docker, Spring Boot and CI configuration.

Input
Output
Output will appear here

About this tool

The same configuration lives in different shapes across a stack: a .env file for local development and Docker, JSON for a Node config loader, YAML for a Compose file or CI pipeline. This converter moves between them without hand-editing — turn a dotenv file into JSON or YAML, or flatten structured config back into KEY=value lines.

It understands the quirks of the .env format that a naive split would miss: quoted values, inline comments, and blank lines. Nested keys are handled so that dotted or structured names round-trip sensibly, which makes it practical for real Docker, Spring Boot and CI configuration rather than only trivial key-value pairs.

How to use

  1. Choose your conversion direction — .env to JSON, .env to YAML, or the reverse.
  2. Paste your source configuration into the input panel.
  3. The converted output appears immediately in the target format.
  4. Check that quoted values and comments were interpreted the way you expect.
  5. Copy the result into your config file, Compose file, or CI settings.
  6. Switch direction and paste back to verify a clean round trip.

Features

  • Converts .env to JSON and YAML, and both formats back to .env.
  • Preserves quoted values instead of breaking on spaces or special characters.
  • Recognizes and skips comment lines starting with #.
  • Handles nested or dotted keys for structured configuration.
  • Ignores blank lines gracefully rather than producing empty entries.
  • Practical for Docker, Spring Boot, and CI pipeline configuration.
  • Runs entirely in the browser, so secrets never leave your machine.

Frequently asked questions

My .env file contains secrets — is it uploaded?

No. All parsing and conversion run locally in your browser with JavaScript. Because .env files routinely hold API keys and passwords, nothing you paste is ever sent to a server.

How are quoted values in the .env treated?

Values wrapped in quotes are preserved as a single value, so a setting like GREETING="hello world" keeps its space instead of being split. The surrounding quotes are handled when converting to JSON or YAML.

What happens to comments?

Lines beginning with # are recognized as comments. When converting to JSON they are dropped since JSON has no comment syntax; the meaningful key-value data is what carries across.

Can it produce nested JSON or YAML?

Yes. Dotted or structured keys are interpreted so that the JSON and YAML output can reflect nesting, and the reverse direction flattens that structure back into KEY=value lines.

Which direction should I use for Docker Compose?

Convert .env to YAML to fold environment variables into a Compose file's environment block, or go the other way to extract a Compose environment section into a reusable .env file.