JSON to Protobuf
Paste a sample JSON object below and generate a proto3 `message` with numbered fields. The tool infers a scalar type for every value, turns arrays into `repeated` fields, and creates a separate message for each nested object.
How the type mapping works
Protobuf is statically typed, so each JSON value is mapped to the closest proto3 scalar: a whole number becomes int32, a decimal becomes double, a string becomes string, true/false becomes bool, and an array becomes a repeated field of the element type. Every nested object becomes its own message, and the parent references it by name.
Field numbers
proto3 identifies each field by a number, not its name — that number is what goes on the wire. The tool assigns = 1, = 2, … in the order the keys appear. Once a schema is in production, keep those numbers stable: changing a field number breaks binary compatibility with already-serialized data.
What one sample can and cannot tell you
A single JSON example is enough to infer the shape, but not the intent. proto3 has no null, so a JSON null is emitted as string — pick the real type yourself. If a whole number can exceed 2.1 billion, switch int32 to int64. Fields that are optional in other responses should still be declared; in proto3 every scalar already has a default.
FAQ
Why is a whole number int32 and not int64?
JSON has one number type, so the tool guesses int32 for whole numbers and double for decimals. If a value can exceed about 2.1 billion (IDs, timestamps in ms), change it to int64 manually.
How are nested objects handled?
Each nested object becomes its own named message, and the parent gets a field of that message type. Arrays of objects become a repeated field of that message.
What happens to JSON null?
proto3 has no null, so a null value is emitted as string as a safe placeholder. Replace it with the real type the field should carry.
Can I reorder or rename fields later?
You can rename fields freely because the wire format uses the field number, not the name. But do not change or reuse a field number once data has been serialized — that breaks compatibility.
Is my JSON uploaded anywhere?
No. Generation runs entirely in your browser with JavaScript; nothing is sent to a server.