Convert BSON to CBOR

Turn BSON files into CBOR. The same structure and key order in CBOR, with integers, floats, booleans, null, text, arrays and maps keeping their types and dates as text.

Converted in an isolated sandbox on our serversDeleted after 24 hours

Drop BSON files on the dialor turn it to pick what to do

MongoDB documents in CBOR.The structure and key order stay the same. Dates, ObjectIds and binary data become text.

  1. What you get

    One CBOR file with the same structure and the same key order as the BSON. Integers, floats, booleans, null, text, arrays and maps keep their types.

  2. What changes

    BSON has types that CBOR does not carry over here, so they are written as text. ObjectIds become hex text. Dates become ISO 8601 text. Binary data becomes base64 text.

    A reader of the CBOR file sees these values as strings, not as dates or binary fields. Your code has to turn them back if it needs the original types. To go the other way, use CBOR to BSON.

BSON and CBOR.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 · CBOR

CBOR

Concise Binary Object Representation, the binary JSON of IoT and web standards.

Extensions
.cbor
MIME type
application/cbor
Kind
Text and data

In your code.The same BSON to CBOR conversion through the API, for your app or your agent.

terminal
$ cv convert report.bson report.cbor
$ cv convert report.bson report.cbor

Questions.What people ask about BSON to CBOR.

01OF 04

Yes. The key order is the same in the CBOR as in the BSON.

Dates become ISO 8601 text. They are not stored as a date type in the CBOR.

As hex text. Binary data is written as base64 text.

Integers and floats keep their types. Booleans, null, text, arrays and maps do too.

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