Convert YAML to BSON
Turn YAML files into BSON. One BSON document with the same keys in order; a top-level list is wrapped under the key items and any other value under value.
Converted in an isolated sandbox on our serversDeleted after 24 hours
Drop YAML files on the dialor turn it to pick what to do
YAML as one BSON document.Keys keep their order and their types. Comments and aliases do not survive as such.
What you get
One BSON file with the same keys in the same order. Integers, floats, booleans, null, text, nested objects and lists keep their types.
A top-level list is wrapped under the key items. Any other top-level value that is not a mapping is wrapped under the key value.
Several documents in one file
A YAML file with several documents becomes a list. Because a top-level list is wrapped under the key items, the BSON document holds that list under items.
What changes
Dates stay text. Values such as yes, on, 0755 and dates are not turned into booleans, numbers or BSON dates. They stay text.
Integers beyond the signed 64-bit range become floats.
Aliases are expanded, so each place that used an alias holds its own copy of the value. Comments are dropped.
A merge key (<<) is kept as an ordinary key instead of being merged. Its entries do not join the mapping around it.
When it fails
A file that cannot be parsed stops the conversion with
input_corrupted.To go the other way, use BSON to YAML.
YAML and BSON.What each format is.
The formats
YAML
YAML configuration and data files.
- Extensions
- .yaml .yml
- MIME type
- application
/yaml - Kind
- Text and data
BSON
MongoDB's binary document encoding, JSON with dates and binary fields.
- Extensions
- .bson
- MIME type
- application
/bson - Kind
- Text and data
In your code.The same YAML to BSON conversion through the API, for your app or your agent.
$ cv convert report.yaml report.bson$ cv convert report.yaml report.bsonQuestions.What people ask about YAML to BSON.
Yes. The BSON document has the same keys in the same order as the YAML.
It is wrapped under the key items, so the BSON file is a document with one key rather than a bare list.
No. Dates stay text, as do values such as yes, on and 0755.
No. A merge key (<<) is kept as an ordinary key and is not merged.