ENV and INI to JSON
Developer Tools · Added
Three formats that look interchangeable and are not: .env has no specification and follows what dotenv does, .ini adds sections, and .properties has a written standard with rules the other two do not share. This reads all three properly and writes them back.
JSON
- Keys
- 4
- Comments
- 1
Dropped — JSON has nowhere to put them
{
"DATABASE_URL": "postgres://localhost:5432/app",
"API_KEY": "abc123",
"DEBUG": "false",
"TIMEOUT": "30"
}Keys and values
| Key | Value |
|---|---|
| DATABASE_URL | postgres://localhost:5432/app |
| API_KEY | abc123 |
| DEBUG | false |
| TIMEOUT | 30 |
1 comment line was dropped. JSON has no comment syntax, so the round trip works and the explanations do not survive it — worth knowing before replacing a documented config file with generated output.
Values stay strings unless you ask otherwise, and that default is deliberate: an environment variable is a string to the process that reads it, so turning 0755 into the number 755, or false into a boolean, changes what the setting means. Everything here runs in your browser — worth knowing, since a real .env file usually holds credentials.
How to use the env and ini to json
- 1Choose the format of the file you have — the hint under the selector says what makes each one different.
- 2Paste the file. Comments, quoting and section headings are all handled.
- 3Read the JSON, or the key table beneath it if you are checking one setting.
- 4Switch the direction to generate a config file from JSON instead.
Examples
A .env with quoting
- Input
- DATABASE_URL="postgres://localhost:5432/app" and TIMEOUT=30 # seconds
- Result
- The URL keeps its quotes stripped; the trailing comment is removed from TIMEOUT
An .ini with sections
- Input
- [database] host = localhost
- Result
- { "database": { "host": "localhost" } }
About the env and ini to json
Why config formats keep multiplying
Each of these solved the previous one's problem. Properties files gave Java a simple key-value store with escaping rules. INI added sections so one file could hold several components' settings. The .env convention stripped it back again to the flat list that maps directly onto environment variables, which is what a twelve-factor application reads.
None of them replaced the others, so a single project routinely contains all three plus JSON and YAML. Converting between them is less about preference than about moving a setting from where it is to where something else expects it.
Nesting is the thing that does not translate
JSON nests and environment variables do not. Converting the other way, a nested object has to be flattened, and the convention every framework settled on is an underscore-joined key: database.host becomes DATABASE_HOST. In .ini it becomes a section instead, which is what sections are for.
The flattening is not reversible without knowing the original shape, which is the reason the dot-splitting option exists in the other direction and is off by default. Splitting on dots turns app.name into a nested object — right if that was the intent, wrong if the key genuinely contained a dot.
Frequently asked questions
Why are values left as strings by default?
What happens to comments?
What makes .properties different from the other two?
Is it safe to paste a real .env file?
Related tools
JSON Formatter
Developer Tools
Pretty-print, minify and inspect JSON with precise error positions.
JSON to YAML Converter
Developer Tools
Convert JSON to YAML or YAML back to JSON, with the ambiguous values quoted.
CSV to JSON Converter
Developer Tools
Convert CSV to JSON or JSON back to CSV, with proper quoted-field handling.