JSON to Protobuf Schema — Free Online
JSON to Protobuf schema generator — produces proto3 messages from any JSON sample. Auto-numbered fields, inferred scalar types, gRPC-ready output.
PDFFlare's JSON to Protobuf converter generates a proto3 schema from any JSON sample — one message per unique object shape, fields numbered in declaration order, inferred scalar types (string, int64, double, bool), repeated for arrays. Drop the result into a .proto file and run protoc to get typed code in any target language.
Need GraphQL types instead? JSON to GraphQL Schema. TypeScript? JSON to TypeScript.
How to Generate proto3 Schema from JSON
Paste a JSON sample
An API response or message body that represents the shape you want to model in Protobuf.
Click Convert to Protobuf
PDFFlare emits proto3 messages — one per unique object shape — with field numbers assigned in declaration order and inferred scalar types.
Drop into your .proto file
Save the schema as messages.proto, run protoc to generate code for your target language, and you've got typed gRPC/Protobuf payloads.
When Do You Need JSON to Protobuf?
Migrating REST → gRPC: You have a JSON-over-HTTP API; you want gRPC. Convert sample payloads to proto3 messages as a starting schema, then refine.
Bridging external APIs: The upstream is JSON; your internal services are gRPC. Generate the proto schema from a real upstream response so your gateway can decode without hand-typed message definitions.
Schema-first prototyping: Sketch a payload as JSON, paste it here, get a starting .protofile. Faster than writing the proto by hand when you're still iterating on shape.
Documenting message contracts: Have a JSON example in vendor docs but want a typed schema for your own use. Convert once, paste into your repo's .proto folder.
Why Use PDFFlare for JSON to Protobuf?
proto3 by Default
Modern proto3 syntax with auto-numbered fields and clean scalar inference — no proto2 boilerplate.
Smart Type Inference
int64 vs double inferred per value. Mixed types fall back to google.protobuf.Value with the import added.
100% Browser-Based
JSON samples stay on your device — safe for production payloads.
No Signup Required
No account, no rate limits.
Frequently Asked Questions About JSON to Protobuf
proto3 is the recommended version for new code (2016+) and matches what most gRPC tooling expects. It's simpler — no required/optional distinctions on scalars, no field defaults, cleaner message definitions. PDFFlare emits proto3 by default; rename `syntax = "proto3";` to `syntax = "proto2";` if you really need proto2.
In declaration order: 1, 2, 3, ... matching the order keys appear in the JSON sample. Critical caveat: in production, field numbers must never change once assigned (changing them breaks wire-format compatibility). Treat the generated numbers as a starting point, then preserve them across schema evolutions.
Strings → string, integers → int64, decimals → double, booleans → bool. JSON nulls and mixed-type arrays fall back to google.protobuf.Value (with the import added automatically). Refine to int32, fixed64, sint32, etc. manually if you know the field's range.
Each unique object shape becomes its own message. Names are inferred from property names (singularized for arrays of objects), giving you defaults like User, Order, Comment. Refactor to nested messages or split across files as your schema grows.
JSON arrays become `repeated` Protobuf fields. The element type is inferred from array contents. Heterogeneous arrays fall back to repeated google.protobuf.Value — if you know the discriminator, refine to a oneof manually.
Yes — and you should refine these manually: oneof unions, map<K,V> types (require a discriminator beyond JSON shape), enum types, deprecated fields, RPC services, and reserved field numbers. The schema gives you the message shapes; the wire-protocol semantics need your judgement.
No. The conversion runs entirely in your browser. JSON samples stay on your device — safe for production payloads.
No — this generates the .proto schema. To get code, run protoc with the appropriate generator plugin (protoc-gen-go, protoc-gen-java, etc.) against the schema. PDFFlare gives you the schema; protoc gives you the code.