Convert JSONC to BSON

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

A BSON document from your JSONC.Keys stay in order, and values keep their types. Comments are dropped.

  1. What you get

    One BSON file with a single document. The keys keep the order they have in the JSONC file.

    Integers, floats, booleans, null and text keep their types. Nested objects and lists stay nested objects and lists.

  2. Top-level lists and other values

    A BSON file holds a document, so the top level must be a document with keys. If your JSONC starts with a list, the list is wrapped under the key items. Any other top-level value, such as a bare number or a string, is wrapped under the key value.

  3. What changes

    Comments and trailing commas are dropped. They have no place in BSON, so only the data is written.

    Dates stay text. A date written as a string in the JSONC is a string in the BSON, not a BSON date.

    Integers beyond the signed 64-bit range become floats.

JSONC and BSON.What each format is.

The formats

From · JSONC

JSON with Comments

JSON that allows comments, as in editor and TypeScript configuration files.

Extensions
.jsonc
MIME type
text/x-jsonc
Kind
Text and data
To · BSON

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

terminal
$ cv convert report.jsonc report.bson
$ cv convert report.jsonc report.bson

Questions.What people ask about JSONC to BSON.

01OF 04

Yes. The document has the same keys in the same order as the JSONC.

They are dropped, along with trailing commas. The BSON holds only the data.

Yes. The list is wrapped under the key items in the BSON document.

No. Dates stay text, so they are written as strings.

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