Convert ENV to JSON with Infer types off when you need to preserve environment values as strings. FindUtils Env JSON Converter creates a flat JSON object and reports duplicate keys before you copy the result.
This guide covers the converter's dotenv rules, two conversion directions, and checks for changed values. The examples use invented configuration data. No credentials are necessary.
Why preserve strings during ENV conversion?
Environment values often look like numbers or booleans, but their receiving application reads text. For example, Node.js interprets dotenv values as strings, including values such as 0 and true. See the Node.js environment variable documentation.
A JSON consumer can distinguish "false" from false. That distinction makes automatic type conversion a decision about application behavior.
- Ports:
"8080"is text;8080is a number. - Flags:
"false"is text;falseis a boolean. - Identifiers:
"007"retains its leading zeros. - Empty values: An empty string keeps a key present.
FindUtils provides browser tools for conversion and inspection. Use the Env Linter when your task is to find configuration problems. Use the converter when you need another file format.
How to convert ENV to JSON
Start with string preservation. Change an option only when you know which value types the destination accepts.
Step 1: Prepare a sample
Remove credentials from the working copy before you use it for a shared review. Open the Env JSON Converter. Select .env to JSON. Paste the following sample or select a local file.
APP_NAME="Field Notes" PORT=8080 DEBUG=false RELEASE_CODE=007 EMPTY= NOTE="Use #blue" PORT=8081
Step 2: Keep the default value rules
Leave Infer types off. Leave Skip empty values off. The converter updates the output when you change the input. No separate conversion button is necessary.
Step 3: Check the duplicate report
The sample defines PORT on lines 2 and 7. The converter keeps the value on line 7. It reports both line numbers. Decide whether 8081 is the value you intend to keep.
Step 4: Compare the result
The result contains six keys. All six values are strings. EMPTY remains present. The quotes around the note preserve its literal hash character.
{
"APP_NAME": "Field Notes",
"PORT": "8081",
"DEBUG": "false",
"RELEASE_CODE": "007",
"EMPTY": "",
"NOTE": "Use #blue"
}Step 5: Export the reviewed object
Copy the output or download env.json. Check the destination's import requirements before you use it. The converter creates a flat object. It does not create a vendor-specific import package.
Examples of options that change the result
The same input can produce different data when you change the options. Record the selected options with the result if another person must repeat the conversion.
Convert values for a typed JSON consumer
Enable Infer types for the sample only if the destination expects numbers and booleans. PORT becomes 8081. DEBUG becomes false. RELEASE_CODE stays "007", because this converter preserves leading-zero identifiers.
Quoted values stay strings even when inference is active. For example, DEBUG="false" produces "DEBUG": "false". The converter also recognizes unquoted null when inference is active. With inference off, the same input produces the string "null".
This option follows a limited scalar rule. It does not apply an application schema. It does not infer dates, arrays, or objects from text.
Decide whether an empty key must remain
For EMPTY=, the default result includes "EMPTY": "". Skip empty values removes that key. When inference creates a JSON null, the same option removes that null entry too.
An absent key can cause an application to use a default. An empty string can produce another result. The receiving application's rules determine which form is correct.
Convert a flat JSON object back to ENV
Select JSON to .env. The current output moves into the input. A JSON object such as this one produces three dotenv lines:
{"APP_NAME": "Field Notes","DEBUG": false,"EMPTY": null}APP_NAME="Field Notes" DEBUG=false EMPTY=
Automatic quoting protects values with spaces, quotes, backslashes, hashes, or line breaks. Quote every value applies quoting to every value. export prefix adds export to each line.
Null becomes an empty value in this direction. A later conversion cannot recover whether that empty value originally came from JSON null or an empty string.
Which conversion settings should you use?
Choose settings from the destination's requirements. A file that parses successfully can still contain the wrong value types.
| Requirement | Setting | Check after conversion |
|---|---|---|
| Keep environment text | Infer types off | Numbers and flags remain quoted JSON strings |
| Supply typed JSON values | Infer types on | Only intended numbers, booleans and null change type |
| Preserve empty entries | Skip empty values off | Empty keys remain present |
| Omit empty entries | Skip empty values on | Removed keys do not trigger an unwanted default |
| Produce dotenv text | JSON to .env | The source is a flat object of scalar values |
The reverse conversion rejects nested objects and arrays. It does not invent a naming rule such as APP__PORT for nested settings.
Common mistakes and corrections
Treat the input as dotenv data. The converter does not execute shell syntax or evaluate application configuration.
Mistake 1: Expecting variable expansion
ASSET_PATH=${BASE_PATH}/assets retains the literal ${BASE_PATH} text. The converter does not substitute another key's value. Resolve that requirement with the destination's documented loader.
Mistake 2: Losing a literal hash
This converter treats an unquoted hash after whitespace as a comment. Use NOTE="Use #blue" when the hash belongs to the value. Do not assume every dotenv loader uses identical comment rules.
Mistake 3: Treating the output as a backup
The output does not preserve comments, repeated definitions, original quote choices, or blank lines. Keep the original document when these details matter. Conversion preserves selected values, not the original file layout.
Mistake 4: Ignoring an invalid line
A line without = or an unterminated quoted value stops this conversion. Correct the named line before you export. Deleting the line without checking its purpose can remove a required setting.
Mistake 5: Assuming every accepted key is portable
The converter accepts dots and hyphens in key names. Some loaders require letters, digits, and underscores. Use names such as APP_PORT when the destination follows that stricter rule.
Tools used in this guide
These tools answer different questions about the same configuration data.
- Env JSON Converter changes dotenv text into a flat JSON object or back into dotenv text.
- Env Linter inspects dotenv lines and can compare expected keys.
- JSON Formatter makes JSON easier to inspect and reports syntax errors.
FAQ
Q1: Does the converter upload my ENV input? A: The conversion runs in the browser. The converter does not send its input to FindUtils. The page can still load advertisements and other external resources.
Q2: Can I use ENV to JSON without an account? A: Yes. The browser converter does not require an account. Its output remains visible in the page, so protect your screen and clipboard.
Q3: Does the converter preserve comments? A: No. Comments do not become JSON entries. Keep the original text if you need its explanations.
Q4: Which duplicate value does the converter keep? A: It keeps the final definition in the input. The warning lists the key and its line numbers.
Q5: Can the converter create nested JSON from underscores?
A: No. A name such as APP_PORT remains one flat key. The converter does not infer object structure from a name.
Q6: Is there a REST or MCP version of this converter? A: No. This converter currently has a browser page only.
Next steps
Use the configuration conversion review to check the meaning of the result. Read the Env Linter guide for checks before conversion. For other source formats, use the JSON to TOML guide or the Properties to JSON guide.