Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Converts JSON to BSON.

Component Version macOS Windows Linux Server iOS SDK
MongoDB 12.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "MongoDB.JSONtoBSON"; JSON { ; FileName } )   More


Parameter Description Example Flags
JSON The JSON to convert.
FileName The file name to use. Optional


Returns FILE Container or error.


Converts JSON to BSON.
Returns a container value with FILE entry containing BSON.
You can use EncodeHex() to convert it to hex string if needed.


Encode a blank object:

HexEncode ( MBS( "MongoDB.JSONtoBSON"; "{}"))

Example result: 0500000000

Encode an array with string:

HexEncode ( MBS( "MongoDB.JSONtoBSON"; "[\"hello\"]"))

See also

This function checks for a license.

Created 22nd May 2022, last changed 29th January 2023

MongoDB.IsTracing - MongoDB.Keys