.env to JSON Converter
Transform any standard .env file into a nested JSON object. UPPER_CASE keys with underscores like APP_DATABASE_URL become nested objects — { "app": { "database": { "url": "..." } } }. Array indices like APP_SERVERS[0] become JSON arrays. Quoted and escaped values are properly handled: \n becomes newline, \t becomes tab.
Use Cases
- Environment Configuration — Convert
.envfiles to structured JSON for programmatic use - CI/CD Pipelines — Transform environment variables into JSON for deployment configs
- Container Orchestration — Bridge Docker/Cloud Run env vars with JSON-based tooling
- Migration — Migrate from flat env variables to structured config files
Example
Input:
APP_NAME=MyApp
APP_VERSION=1.0.0
APP_SERVERS[0]=192.168.1.1
APP_SERVERS[1]=192.168.1.2
APP_DATABASE_URL=jdbc:postgresql://localhost:5432/mydb
APP_DATABASE_POOL_MAX_ACTIVE=10
APP_DATABASE_POOL_TIMEOUT_MS=30000Output:
{
"app": {
"name": "MyApp",
"version": "1.0.0",
"servers": ["192.168.1.1", "192.168.1.2"],
"database": {
"url": "jdbc:postgresql://localhost:5432/mydb",
"pool": {
"maxActive": 10,
"timeoutMs": 30000
}
}
}
}