Convert JSON5 to ENV

Turn JSON5 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 JSON5 files on the dialor turn it to pick what to do

A JSON5 file as KEY=value lines.Each top-level key becomes one line in a single ENV file.

  1. What you get

    One ENV file with a KEY=value line for each top-level key. Characters that a variable name cannot hold are turned into underscores.

    Text with spaces or symbols is double-quoted with escapes. JSON5 numbers become plain numbers, and null leaves the value empty.

  2. Lists and nested data

    A top-level list numbers its entries from 0 under items. The name of the first entry becomes items_0_name.

    Nested objects and lists become quoted JSON text.

  3. What it leaves behind

    Comments are dropped. Only the keys and values reach the ENV file.

    To go the other way, use ENV to JSON5.

JSON5 and ENV.What each format is.

The formats

From · JSON5

JSON5

JSON with comments, trailing commas and unquoted keys.

Extensions
.json5
MIME type
application/json5
Kind
Text and data
To · ENV

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 JSON5 to ENV conversion through the API, for your app or your agent.

terminal
$ cv convert report.json5 report.env
$ cv convert report.json5 report.env

Questions.What people ask about JSON5 to ENV.

01OF 04

Characters that a variable name cannot hold are turned into underscores. A key with a dash, for example, gets an underscore in its place.

Null leaves the value empty, so the line has the key and nothing after the equals sign.

No. Comments are dropped.

The entries are numbered from 0 under items. The name of the first entry becomes items_0_name.

More conversions.Other ways in and out of JSON5 and ENV.