Processed in your browser

YAML / BSON Converter

Supports MongoDB document and driver testing. Ordinary YAML encodes to BSON, while decoded BSON-specific types appear as explicit marker objects instead of corrupting long integers or dates.

Processed in your browser
0 / 1,500,000
Converted output

Tool guide

What is YAML / BSON Converter?

YAML and BSON Converter supports MongoDB document and driver debugging. An ordinary YAML root object encodes to Base64 BSON, while decoded ObjectId, dates, long integers, and other BSON-specific values appear as explicit marker objects rather than being forced into misleading scalar values. Common workflows include the following. Generate MongoDB driver fixtures. Decode BSON Base64 from logs. Inspect long integers and dates. The page also documents input boundaries, output behavior, and practical cautions so you can review the result before putting it into an application, configuration, test, or production workflow.

When to use it

  • Generate MongoDB driver fixtures.
  • Decode BSON Base64 from logs.
  • Inspect long integers and dates.

How to use it

  1. Use a root YAML object for encoding.
  2. Paste complete BSON Base64 for decoding.
  3. Load the example to verify ordinary fields.
  4. Convert and read the extended-type warning.
  5. Review the result against the destination driver contract.
  6. Load one of the realistic examples first to verify the selected options and processing direction before replacing it with your own data.

Runnable examples

The “Example 1” and “Example 2” buttons load the matching inputs. They cover different structures, directions, or boundaries and can be run directly in the workspace.

Example 1

site: JSONLane
release:
  tools: 50
  ready: true
tags: [yaml, bson]

Example 2

IwAAAAJzaXRlAAkAAABKU09OTGFuZQAQdG9vbHMAMgAAAAA=

Input rules

  • YAML encoding requires a root object.
  • Decoding requires complete BSON Base64.
  • Dangerous keys and unsafe numbers are rejected.
  • Text input is counted before processing and is limited to 1,500,000 characters on this page; file modes apply the separate file limit shown in the workspace.
  • BSON encoding requires a YAML root object.

Output rules

  • BSON binary uses Base64.
  • Extended values become marker objects.
  • Ordinary consumers may not understand markers.
  • Output reflects only the current input, direction, and options; rerun after changing a mode or value instead of treating an earlier result as current.
  • Binary BSON is carried as Base64.

Limitations and cautions

  • BSON encoding requires a YAML root object.
  • Binary BSON is carried as Base64.
  • BSON-specific values appear as marker objects in YAML.

How your data is handled

All parsing, format conversion, Base64 work, and intermediate data remain in the current browser tab. JSONLane does not upload the input or retain it after refresh or close.

FAQ

Is YAML or BSON content uploaded?

No. Parsing, conversion, and output generation remain in the current browser tab.

Is every round trip lossless?

No. Comments, layout, type systems, and binary capabilities differ, so the page identifies the areas that require review.

Why can valid input still be rejected?

The destination may not have a safe representation. Dangerous keys, unsafe integers, excessive depth, and ambiguous mappings are rejected instead of silently rewritten.

Can ordinary YAML produce BSON?

Yes, when the YAML root is an object.

How are long integers retained?

Decoded BSON uses Extended JSON marker objects to avoid precision loss.

Can Base64 be imported directly into MongoDB?

Usually not. A driver expects the original BSON bytes after Base64 decoding.

Updated: 2026-08-09