Protobuf payloads are compact and fast, but writing the wire format by hand is fiddly: varint keys, base-128 encoding, length prefixes. JSON to Protobuf encodes a JSON document into the protobuf binary wire format without needing a .proto schema — ideal for building test payloads, verifying serializers and generating fixtures.
JSON to Protobuf
Encode a JSON document into the protobuf binary wire format — no .proto schema needed.
Encoding rules (schema-less)
| JSON value | Wire type | Encoding |
|---|---|---|
| true / false | 0 (varint) | 01 / 00 |
| 42 | 0 (varint) | 2A |
| -1 | 0 (varint) | 10-byte two's complement |
| 3.14 | 1 (64-bit) | little-endian float64 |
| "text" | 2 (length-delimited) | key + varint len + UTF-8 |
| [ ... ] | repeated | each element with the same field number |
| { ... } | 2 (embedded message) | recursive encode, length-prefixed |
| null | — | field omitted |
About JSON to Protobuf
Features
- No schema needed: Field numbers are assigned in key order.
- Correct varints: Keys, lengths and integers use base-128 encoding.
- Negative integers: Standard 10-byte two's complement varint.
- Repeated fields: Arrays map to proto3 repeated semantics.
- Embedded messages: Nested objects become length-delimited messages.
- Three outputs: hex, base64 and a downloadable .bin file.
- Private: All encoding happens in your browser.
How to Use
- Paste your JSON into the input box (or load the sample).
- Encode and review the hex output.
- Check the byte count and the field summary.
- Download the .bin file if you need the raw bytes.
Examples
Example 1 — Test fixtures. An engineer generates protobuf wire bytes from readable JSON to feed into unit tests of a serializer.
Example 2 — gRPC debugging. A developer encodes a request payload to compare against a captured stream in Wireshark.
Example 3 — Server mocks. A backend engineer creates binary fixtures for load tests without writing a protoc build step.
Example 4 — Learning the format. A student encodes sample documents to see exactly how varint keys and length prefixes look.
Benefits
- Instant: Encoding happens in the browser in milliseconds.
- Schema-less: No .proto compilation required.
- Correct: Standard wire types and varint rules.
- Inspectable: See every byte in hex.
- Zero upload: Data never leaves your machine.
Frequently Asked Questions
How can JSON be encoded as protobuf without a .proto schema?
Which wire types are used?
How are arrays encoded?
How are nested objects encoded?
Which output formats are available?
Is my JSON uploaded anywhere?
More JSON Tools
View AllCSV to JSON Converter
Convert CSV data into a clean JSON array of objects instantly. Handles...
Prettify JSON
Format messy JSON into clean, readable indented output in one click. C...
JSON to TOML
Convert a JSON config to TOML in one click: [table] headers, [[array o...
JSON to YAML Converter
Convert JSON to clean, properly indented YAML instantly. Paste or uplo...
CSON to JSON
Parse a CSON file into JSON in one click: indented blocks, block array...