Convert JSONC to ENV
Turn JSONC files into Dotenv. Each top-level key becomes a KEY=value line, with characters a variable name cannot hold turned into underscores, and a top-level list numbers its entries from 0 under items, so the name of the first entry becomes items_0_name.
Converted in an isolated sandbox on our serversDeleted after 24 hours
Drop JSONC files on the dialor turn it to pick what to do
JSONC settings as KEY=value lines.Each top-level key becomes one line in a single ENV file. Comments are dropped.
What you get
One ENV file with a KEY=value line for each top-level key in the JSONC file. Characters that a variable name cannot hold are turned into underscores in the key.
Text with spaces or symbols is double-quoted with escapes. A null value leaves the value empty.
Nested data
Nested objects and lists become quoted JSON text. They are not split into separate lines.
A top-level list numbers its entries from 0 under items. The name of the first entry becomes items_0_name.
What it leaves behind
Comments and trailing commas are dropped. The ENV file holds only the keys and their values.
To go the other way, use ENV to JSONC.
JSONC and ENV.What each format is.
The formats
JSON with Comments
JSON that allows comments, as in editor and TypeScript configuration files.
- Extensions
- .jsonc
- MIME type
- text
/x -jsonc - Kind
- Text and data
Dotenv
KEY=value lines that hold environment variables for an app.
- Extensions
- .env
- MIME type
- text
/x -env - Kind
- Text and data
In your code.The same JSONC to ENV conversion through the API, for your app or your agent.
$ cv convert report.jsonc report.env$ cv convert report.jsonc report.envQuestions.What people ask about JSONC to ENV.
No. Comments are dropped, and so are trailing commas.
Characters a variable name cannot hold are turned into underscores. A key with such a character comes out with an underscore in its place.
They become quoted JSON text in the value. Nothing inside them is turned into separate lines.
The value is left empty. The key stays on its line.