Loading BSON Formatter...

How to Format BSON - Step by Step Guide

Step 1

Input Your BSON Data

Let's format your BSON data! Whether you're debugging MongoDB exports, analyzing database dumps, or converting for better readability, you have several convenient options:

Paste directly: Copy your BSON data in Base64 or Hex format from mongodump exports or MongoDB drivers
Upload a file: Click "Upload" to select a .bson or .bin file from your computer
Choose format: Select Base64 (compact) or Hex (debug-friendly) encoding
Try the sample: Click "Sample" to load example BSON and see the formatting in action

Example: Unformatted BSON Input (Base64)

Here's what raw, unreadable BSON data looks like:

VgAAAAJjdXN0b21lcklkAA0AAABDVVNULTEyMzQ1AAJwaG9uZU51bWJlcgAPAAAAKzE1NTUtMTIzNDU2NwACcGxhblR5cGUADgAAAFVubGltaXRlZCA1RwAQZGF0YVVzYWdlR0IALQAAAAhpc0FjdGl2ZQABAAA=
Step 2

Automatic Formatting & Validation

The magic happens instantly! As soon as you input BSON data, the formatter automatically:

Decodes BSON: Converts binary BSON to readable JSON format
Validates structure: Checks for errors and confirms BSON integrity
Adds proper indentation: Makes nested objects and arrays easy to read with 2-space indentation
Preserves MongoDB types: Maintains ObjectId, Date, and other MongoDB-specific data types in Extended JSON format
Syntax highlighting: Color-codes different elements for better readability

Example: Beautifully Formatted Output (JSON)

The same BSON, now decoded and properly formatted:

{
  "customerId": "CUST-12345",
  "phoneNumber": "+1555-1234567",
  "planType": "Unlimited 5G",
  "dataUsageGB": 45,
  "isActive": true
}
Step 3

Choose Format Options

Customize your output based on your needs! The formatter gives you control over how your JSON appears:

Pretty format: Default beautified JSON with proper indentation (2 spaces) for debugging
Minify option: Click "Minify" to compress JSON into a single line for production use or APIs
Extended JSON: MongoDB types are preserved in Extended JSON (EJSON) format for accuracy
Step 4

Export Your Formatted JSON

Get your perfectly formatted JSON ready for use! Multiple export options make it easy to integrate into your workflow:

Copy to clipboard: One-click copying for quick pasting into your code editor, documentation, or MongoDB Compass
Download as JSON: Save as a .json file for sharing, analysis, or integration with other tools
Real-time validation: Green checkmark confirms your BSON is valid and successfully formatted

Frequently Asked Questions

How do I format BSON from MongoDB?

Simply paste your BSON data (Base64 or Hex format) into the formatter, or upload a .bson file. The tool automatically decodes it to beautifully formatted JSON with proper indentation, making it easy to read and understand.

What's the difference between Base64 and Hex input?

Both represent the same binary BSON data in text form. Base64 is more compact (commonly used in APIs), while Hex is easier to debug byte-by-byte. The formatter handles both - just select the format you're using.

Can I both format and minify BSON?

Yes! By default, the formatter outputs pretty, indented JSON for readability. Click "Minify" to compress it into a single line - perfect for production APIs or reducing file size while maintaining all data.

Are MongoDB types preserved when formatting?

Absolutely! The formatter uses Extended JSON (EJSON) format to preserve all MongoDB-specific types including ObjectId, Date, Binary, Decimal128, and Timestamp. No data is lost during formatting.

Can I format large BSON files?

Yes! The formatter handles large BSON files efficiently. All processing happens in your browser for privacy and security. There are no file size limitations or usage restrictions.

Is the BSON formatter free?

Yes, completely free with unlimited formatting! No registration required, and all processing happens locally in your browser for maximum privacy and security. Format as much BSON as you need.