Protobuf / MessagePack / CBOR / BSON Decoder Online
Decode and encode Protobuf (with a .proto or schemaless), MessagePack, CBOR and BSON to and from JSON. Input base64, hex or a file; output base64 and hex.
Result
Press “Run” to see the result.
Pick a format (protobuf, msgpack, cbor, bson) and an action. To decode, send the bytes as data (base64 or hex, detected automatically; spaces, 0x and colons are ignored) or upload a file; the result is JSON. To encode, send the value as json; the result has base64, hex and the size. to converts a decoded value straight into another format (for example MessagePack → CBOR).
Protobuf: give the schema in proto (proto2 / proto3 text, with nested messages, enums, maps, oneofs, packed repeated fields, 64-bit integers kept exact as strings) and message_type (e.g. shop.Order). Field names may be the .proto names or lowerCamelCase; enums accept names or numbers; bytes are base64. defaults=true fills missing fields with their default values, enums_as_numbers=true returns enum numbers. Without proto, the wire data is decoded schemalessly: each field number with its wire type and possible readings (unsigned, signed zigzag, float / double, UTF-8 string or nested message).
In JSON, binary values appear as {"$bytes": "<base64>"}, CBOR tags as {"$tag": n, "value": …}, MessagePack extensions as {"$ext": type, "$bytes": …}, big integers as strings and timestamps as ISO dates; the same forms are accepted when encoding. BSON uses MongoDB Extended JSON ($oid, $date, $numberLong…, relaxed by default, ejson=canonical for canonical). Size limit: 2 MB of binary data.
Use this in your code
curl -X POST "https://apibox.io.vn/v1/binary-formats" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"format":"protobuf","proto":"syntax = \"proto3\";\nmessage Test1 { int32 a = 1; }","data":"089601"}'const res = await fetch('https://apibox.io.vn/v1/binary-formats', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"format": "protobuf",
"proto": "syntax = \"proto3\";\nmessage Test1 { int32 a = 1; }",
"data": "089601"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/binary-formats",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"format": "protobuf", "proto": "syntax = \"proto3\";\nmessage Test1 { int32 a = 1; }", "data": "089601"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/binary-formats');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"format":"protobuf","proto":"syntax = \\"proto3\\";\\nmessage Test1 { int32 a = 1; }","data":"089601"}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));API documentation → Get a free API key
FAQ
Can I decode Protobuf without the .proto file?
Yes. The schemaless mode shows field numbers, wire types and the plausible values of each field, and opens nested messages. Names and exact types need the schema.
Are imports in .proto files supported?
Only a single self-contained schema: paste the imported messages into the same text. google.protobuf well-known types are treated as ordinary messages.
How are 64-bit integers handled?
They are read and written exactly: as decimal strings in JSON (Protobuf int64 / uint64, MessagePack and CBOR big integers) and as $numberLong in BSON when they do not fit in a JavaScript number.