JSON to Go Struct — Free Online
Generate Go structs from a JSON sample. Each unique shape gets its own struct, with json:"..." tags preserving the original keys.
Generate Go structs from any JSON sample — one struct per unique object shape, json:"..." tags preserving original keys, sensible type inference (int, float64, bool, []T). Drop the result straight into a .go file in a project that uses encoding/json or any compatible library.
Need TypeScript instead? JSON to TypeScript. Python? JSON to Python. Rust? JSON to Rust.
How to Generate Go Structs from JSON
Paste a JSON sample
An API response, a config payload, anything that represents the shape you want to model.
Click Convert to Go
PDFFlare emits one struct per unique object shape, with json tags preserving original field names.
Drop into your project
Paste the structs into your .go file, rename Root to your domain type, and you're done.
When Do You Need JSON to Go?
Typing a third-party API: The vendor docs are out of date. Hit the endpoint, copy the JSON response, paste here, get accurate Go types.
Migrating from a dynamic language: Porting a Python or Node service to Go? Use real production payloads to seed the type definitions.
Webhook handlers: Stripe, GitHub, and similar services document their webhook payloads as JSON examples. Convert each example to Go to build typed handlers.
CLI tools: Building a CLI that consumes JSON from another tool? Generate the input schema as Go structs in seconds.
Why Use PDFFlare for JSON to Go?
json Tags Preserved
Every field carries the original JSON key in its struct tag — your structs decode incoming JSON correctly out of the box.
Smart Type Inference
int vs float64 inferred from the actual values. Arrays infer their element type when uniform.
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 Go
Yes — every field has a json:"key" tag preserving the original JSON key, and field types map cleanly (string, int, float64, bool, []T).
Each unique object shape becomes its own named struct. Names are inferred from property names (singularized for arrays of objects), giving you sensible defaults like User, Post, Comment.
Mixed-type arrays produce []interface{} since Go doesn't have unions. Refine to a more specific type if you know the shape.
Yes. Whole-number values become int; decimal values become float64. JSON treats both as 'number' but the converter inspects each value.
Yes — every field is PascalCased so it's exported (visible to encoding/json). The original key is preserved via the struct tag.
A safe placeholder you can easily find-and-replace with your domain name (User, ApiResponse, Config). Trying to guess intent from JSON usually picks the wrong noun.
No. The conversion runs entirely in your browser.
It produces standard struct definitions matching Go conventions (PascalCase exports, json tags, idiomatic types). Manual passes can refine: add omitempty, rename fields, swap interface{} for stronger types.