Advertisement

JSON to Protobuf

Turn JSON into Protocol Buffer message definitions. Numbered fields, scalar types, repeated fields, and nested messages are generated for you.

JSON input

Paste JSON, optionally name the root type, then generate.

Your Protobuf message code will appear here.
Advertisement

From JSON to binary contracts

Teams moving from JSON REST to gRPC need .proto definitions that match existing payloads. This tool converts a sample response into proto3 messages, so your new binary API speaks the same shape as the old JSON one.

Field numbers matter

The generated numbers are a starting point. Once a .proto ships, never reuse or reorder numbers: protobuf's backward compatibility depends on those numbers staying put forever.

JSON to Protobuf FAQs

What is Protocol Buffers?
Protobuf is Google's binary serialization format: you define messages in a .proto file, compile them, and get fast, tiny, typed payloads for APIs and storage.
Why do fields have numbers?
Field numbers identify fields on the wire and must never change once used. The generator assigns them sequentially; keep them stable when you evolve the schema.
How are JSON arrays represented?
Arrays become repeated fields, which is protobuf's list type, with the element type inferred from the sample items.
How are optional fields handled?
Uncertain fields use the proto3 optional keyword, which restores explicit presence tracking so you can tell missing apart from default values.
Which scalar types are used?
Strings become string, whole numbers int32, decimals double, and booleans bool, covering the standard JSON to protobuf mapping.
Advertisement