Skip to content
ConvertPassConvertPass home

Developer

JSON to .env

Write a .env file from a JSON object without guessing nested key names.

This tool processes files and text locally in your browser. Your content is not uploaded or stored by this site.

0 B
Empty

Empty. Paste text, drop a file, or load the example.

What this tool does

Each key must be a valid environment variable name. Values that need spaces or punctuation are double-quoted. Nested objects become a JSON string, which is explicit and reversible.

How to use it

  1. Paste a flat JSON object.
  2. Download converted.env.
  3. Check quoting before sourcing the file in a shell.

Supported input

  • JSON object, UTF-8, up to 2 MB

Output

  • dotenv text

Privacy

This tool processes files and text locally in your browser. Your content is not uploaded or stored by this site.

ConvertPass does not include your input in analytics, URLs, or error reports. Encoding: UTF-8. Limit: 2 MB (2.00 MB).

Limitations

  • Nested flattening such as DATABASE_HOST is not generated.
  • Shell sourcing still depends on your shell.

Example

Input
{"APP_URL":"https://convertpass.com","DEBUG":"true"}
Output
APP_URL=https://convertpass.com
DEBUG=true

Troubleshooting

Invalid environment variable name
Rename keys to letters, numbers, and underscores, starting with a letter or underscore.

FAQ

Why not flatten nested JSON?

database.host versus DATABASE_HOST versus database_host are all plausible. Inventing a convention would surprise someone. Nested values stay as JSON strings instead.

Can I source the output in bash?

For simple values, yes. For JSON-in-a-value, prefer a dotenv parser over source, because nested quotes are easy to get wrong in a shell.

Are empty values kept?

Yes. KEY= is a valid assignment.

Will this export KEY=value with export?

No. Add export yourself if your process needs it.

Related tools

  • .env to JSON

    Parse a .env file into JSON without sending secrets to a server.

  • JSON to TOML

    Serialise JSON config as TOML when the root is an object.

  • JSON to YAML

    Turn JSON into readable YAML without leaving your machine.

Related guides

Related formats

Last reviewed 16 August 2026. Report a problem. Reports do not include your input.