BSON Editing Tools

Binary JSON Support for MongoDB

  • Edit JSON schemas for BSON
  • Built-in support for BSON type selection
  • BSON datatypes for objects, properties, and array items

What is BSON?

BSON (Binary JSON) is the data format used by popular MongoDB NoSQL database. It’s similar to JSON but designed for efficient storage and scanning. Unlike JSON, BSON is a binary format that is not human-readable by default. BSON’s binary structure encodes type and length information, which allows it to be parsed much more quickly than straight JSON. Since its initial formulation, BSON has been extended to add some optional non-JSON-native data types, like dates and binary data, which are essential for MongoDB.

Editing BSON in JSON Schema

BSON editor in XMLSpy

XMLSpy includes a powerful graphical JSON Schema editor with built-in support for defining BSON datatypes.

MongoDB provides the ability to validate database data against a JSON schema document. Because BSON datatypes supplement the standard JSON types, XMLSpy provides an editing layer for BSON that lets you add and modify BSON-specific schema features during JSON Schema development.

When you enable BSON support in JSON Schema View, BSON datatypes become available for JSON objects, properties, and array items. When a component's base type has been selected to be BSON, the BSON types become available for selection.

Support for BSON in the XMLSpy graphical JSON schema editor helps teams enable validation of real-world BSON data for MongoDB and other applications.

Example Use Case

MongoDB is schema-less by default, but real-world apps often need to validate the structure and types of data being stored. That’s where JSON Schema comes in, and support for BSON in XMLSpy makes it easy to implement.

A real world example of where this support is important is a development team working on a healthcare app uses MongoDB to store patient records. They want to:

  • Validate incoming data from a mobile app
  • Ensure fields like _id (ObjectId), birthDate (Date), and dosage (Decimal128) are used correctly

With XMLSpy, they can:

  • Create a JSON Schema using BSON data types
  • Validate real data before it hits the database
  • Share the schema with frontend developers and API teams

With its visual schema design paradigm, developers can get the job done quickly and with fewer errors. An optional final step is to use Altova MapForce to map, transform, and integrate the MongoDB data with other systems like SQL databases and XML reports.