JSON to Protobuf Message
Draft Protocol Buffers message declarations from a sample JSON object.
Translate JSON shape into Protobuf syntax
Protocol Buffers requires explicit message fields and numeric tags before data can be serialized. This generator reads a JSON object and creates proto3 messages for its root and nested records. Whole numbers map to int64, decimal values to double, booleans to bool, strings to string, and arrays to repeated fields using an example item for their element type.
The default sample emits message User with int64 user_id assigned field 1, string name as field 2, and bool active as field 3. Nested objects receive separate message declarations, while an array of records becomes a repeated child message. This provides a readable schema draft for discussing a migration from JSON transport to Protobuf.
Treat field numbers as a first draft
Field numbers are protocol identity, so the generated sequential tags must be reviewed before anything is deployed. Never renumber a published field, and reserve numbers removed from an established schema. Null and empty arrays fall back to google.protobuf.Value because their specific type is unknowable. Generation stays in your browser; confirm integer signedness, optional presence, enums, maps, and package names manually.
Frequently Asked Questions
Are the generated field numbers safe to publish immediately?
They are deterministic sequential draft numbers. Review them carefully because published Protobuf tags must remain stable forever.
How are JSON arrays converted?
Arrays become repeated fields, with the member type inferred from the first item when one exists.
Why is google.protobuf.Value imported?
It provides a fallback for null and empty-array cases where the sample cannot reveal a concrete type.
Browse the full set of free, private, in-browser tools.