How to unflatten environment variable names into a json config tree
- Step 1List the environment variables as a flat JSON object — Convert your .env file or environment variable list to a JSON object: { "APP_DB_HOST": "localhost", "APP_DB_PORT": "5432", "APP_REDIS_URL": "redis://..." }.
- Step 2Strip the common prefix before unflattening — Use the JSON Key Renamer tool to remove the common APP_ prefix first, leaving DB_HOST, DB_PORT, REDIS_URL. Then unflatten with underscore separator to get { db: { host, port }, redis: { url } }.
- Step 3Review and type-check the output — Check that PORT numbers are integers, boolean environment variables are proper booleans, and URL strings are correctly preserved. The JSON Format Fixer can auto-cast numeric strings.
- Step 4Use as the config schema reference — Use the reconstructed JSON as a reference to generate a Zod schema or TypeScript interface for your application configuration. The nested structure makes it easy to see the configuration domain groupings.
Frequently asked questions
How do I handle prefixes like APP_ or SERVICE_ that should not become nesting levels?+
Use the JSON Key Renamer tool first to strip the common prefix from all keys before unflattening. If keys have the pattern APP_DB_HOST, rename the prefix APP_ to empty string first, then unflatten DB_HOST to { db: { host } }.
What about environment variables with underscores that are not separators — like S3_BUCKET_NAME?+
S3_BUCKET_NAME would unflatten to { s3: { bucket: { name } } } which may not be the intended structure. For these cases, consider using a different naming convention (S3__BUCKET_NAME with double underscore as separator) or manually adjust the output after unflattening.
Are environment variable values — including connection strings — transmitted to JAD Apps?+
No. The JSON unflattening runs entirely in your browser. Environment variable values including database connection strings, API keys, and secrets are never transmitted to JAD Apps servers.
Privacy first
Conversion runs locally in your browser. No file is uploaded — only metadata counters are saved for signed-in dashboard stats.