Babbel CLI (babbel-cli)
Universal, high-performance command-line utility for multi-format serialization, document querying, structural AST diffing, RFC 6902 patching, schema validation, and formatting across 16 data formats.
Installation
From Source
Verify installation:
Command Reference
1. babbel convert — Universal Cross-Format Conversion
Converts documents between any of the 16 supported formats with automatic format autodetection.
# Convert Terraform HCL to JSON
# Convert JSON to Apache Parquet
# Pipe XML from stdin to YAML on stdout
|
# Convert CBOR binary payload to compact MessagePack
Options:
-f, --from <FORMAT>: Source format (auto-detected from file extension if omitted).-t, --to <FORMAT>: Target format (json,yaml,toml,xml,cbor,msgpack,bson,ron,kdl,parquet,hcl,avro,csv,tsv,ini,bencode).-o, --output <PATH>: Output file path (defaults to stdout).--pretty: Pretty-print formatted output (default: true for text formats).--indent <N>: Indentation spaces for formatted text (default: 2).
2. babbel query — RFC 9535 JSONPath Document Querying
Executes standard JSONPath query expressions across any format without requiring format-specific tools.
# Query YAML configuration with filter expression
# Extract the first matching element from a TOML file
# Query an Avro container file
Options:
-q, --query <EXPR>: RFC 9535 JSONPath expression (e.g.$.store.book[*].author).--first: Return only the first match instead of an array of matches.
3. babbel diff — Structural Document Diffing
Computes structural deltas between two documents, producing standard RFC 6902 JSON Patch operations or RFC 7396 Merge Patch representations.
# Compute RFC 6902 patch between original and modified configs
# Compute RFC 7396 Merge Patch
4. babbel patch — Atomic Document Patching
Applies an RFC 6902 JSON Patch or RFC 7396 Merge Patch file to a document.
# Apply RFC 6902 patch to update a configuration
# Apply RFC 7396 Merge Patch
5. babbel validate — JSON Schema Validation
Validates any document (JSON, YAML, TOML, XML, KDL, HCL, etc.) against a standard JSON Schema (Draft 7 / Draft 2020-12).
# Validate Kubernetes YAML manifest against schema
# Validate TOML configuration
6. babbel fmt — Document Formatting & Pretty-Printing
Formats, validates syntax, and pretty-prints documents with customizable indentation.
# Pretty-print and format a minified JSON file in-place
7. babbel inspect — Document Diagnostics
Analyzes a document, displaying its detected format, AST data type, record count, byte size, and maximum nesting depth.
Output:
File: complex.avro
Detected Format: avro (application/avro)
Data Type: Array
Record Count: 3
Size: 265 bytes
Max Nesting Depth: 2
Supported Formats
| Format ID | MIME Type | Extensions | Classification |
|---|---|---|---|
json |
application/json |
.json |
Text |
yaml |
application/yaml |
.yaml, .yml |
Text |
toml |
application/toml |
.toml |
Text |
xml |
application/xml |
.xml |
Text |
hcl |
application/x-hcl |
.hcl, .tf |
Text |
kdl |
application/kdl |
.kdl |
Text |
ron |
application/ron |
.ron |
Text |
jsonl |
application/x-ndjson |
.jsonl, .ndjson |
Text |
csv |
text/csv |
.csv |
Text |
tsv |
text/tab-separated-values |
.tsv |
Text |
ini |
text/plain |
.ini, .env, .properties |
Text |
cbor |
application/cbor |
.cbor |
Binary |
msgpack |
application/msgpack |
.msgpack, .mp |
Binary |
bson |
application/bson |
.bson |
Binary |
avro |
application/avro |
.avro |
Binary |
parquet |
application/x-parquet |
.parquet |
Binary |
bencode |
application/x-bencode |
.bencode, .torrent |
Binary |