.env to JSON Converter API
Convert a .env file to JSON, YAML, docker run -e flags or a Kubernetes env list, or a flat JSON object back to .env. Reports duplicate keys (last value wins).
POST /api/v1/tools/env-json-converterMCP env_json_converterData & ConversionConvert .env files to JSON and back, or to YAML, docker run -e flags and a Kubernetes env list. Handles quotes, comments, export and multi-line values in your browser.
Input
Send these as a JSON object. Unknown fields are rejected.
- input
- A .env file (KEY=value lines, comments, export prefixes and quotes allowed) or a flat JSON object of names and values. (string, required)
- from
- Input format: env (dotenv syntax), json (a flat object), or auto (JSON if it starts with {). (string, one of auto, env, json, default "auto")
- to
- Output format. (string, one of json, env, yaml, docker, kubernetes, default "json")
curl https://pithlab.com/api/v1/tools/env-json-converter \n -H "Authorization: Bearer $PITHLAB_KEY" \n -H "Content-Type: application/json" \n -d '{"input":"# Database\nDATABASE_URL=postgres://localhost/app\nexport PORT=8080\nGREETING=\"Hello\\nWorld\"","to":"json"}'Example response
{
"ok": true,
"result": {
"output": "{\n \"DATABASE_URL\": \"postgres://localhost/app\",\n \"PORT\": \"8080\",\n \"GREETING\": \"Hello\\nWorld\"\n}",
"count": 3,
"duplicates": [],
"nonPortableKeys": [],
"warnings": []
}
}