Convert BSON to ENV

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

BSON turned into KEY=value lines.Each top-level key becomes one line in a Dotenv file.

  1. What you get

    One ENV file. Each top-level key in the BSON document becomes a KEY=value line. 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.

  2. How special values appear

    BSON has types that ENV has no place for, so they become text. ObjectIds become hex text, dates become ISO 8601 text and binary data becomes base64.

    Nested objects and lists become quoted JSON text.

  3. Top-level lists

    When the top level is a list, its entries are numbered from 0 under items. The name of the first entry becomes items_0_name.

    To go the other way, use ENV to BSON. For other options, see every ENV conversion.

BSON and ENV.What each format is.

The formats

From · BSON

BSON

MongoDB's binary document encoding, JSON with dates and binary fields.

Extensions
.bson
MIME type
application/bson
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 BSON to ENV conversion through the API, for your app or your agent.

terminal
$ cv convert report.bson report.env
$ cv convert report.bson report.env

Questions.What people ask about BSON to ENV.

01OF 04

Each top-level key becomes the name on a KEY=value line. Characters a variable name cannot hold are turned into underscores.

They become quoted JSON text as the value of their line.

Dates become ISO 8601 text and ObjectIds become hex text. Binary data becomes base64.

The value is left empty on its line.

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