Convert BSON to HCL
Turn BSON files into HCL. Every document, with its keys in order; several documents become a list.
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 documents as HCL attributes.Every document keeps its keys in order. Several documents become a list.
What you get
One HCL file with your BSON data written as HCL attributes. Keys stay in the order they have in the document.
If the BSON file holds several documents, they become a list. A top-level list is written as the attribute
items.How values change
HCL has no types for BSON's special values, so they become text or small objects. ObjectIds become hex text, dates become ISO 8601 text, and binary data becomes base64. UUIDs become their usual text, and Decimal128 values become decimal text.
Timestamps and DBRefs become small objects. Nulls stay null.
Key names
The keys of a top-level object must be identifiers. Nested keys are quoted, so they can hold any text.
A conversion stops with
unsupported_elementswhen the file holds something HCL cannot carry. A file that cannot be parsed stops withinput_corrupted.
BSON and HCL.What each format is.
The formats
BSON
MongoDB's binary document encoding, JSON with dates and binary fields.
- Extensions
- .bson
- MIME type
- application
/bson - Kind
- Text and data
HCL
HashiCorp Configuration Language, what Terraform and Packer files are written in.
- Extensions
- .hcl .tf .tfvars
- MIME type
- application
/x -hcl - Kind
- Text and data
In your code.The same BSON to HCL conversion through the API, for your app or your agent.
$ cv convert report.bson report.hcl$ cv convert report.bson report.hclQuestions.What people ask about BSON to HCL.
ObjectIds become hex text. Dates become ISO 8601 text.
Binary data becomes base64 text. UUIDs are written as their usual text.
They become a list. A top-level list is written as the attribute items.
The file could not be parsed as BSON. To go the other way, use HCL to BSON.