Need to convert Go into JSON Schema?
JSON Input
Generated Go
Enter JSON data to generate Go structs
Structs with proper field names and JSON tags
Generate Go structs from JSON data structures
Need to convert Go into JSON Schema?
Enter JSON data to generate Go structs
Structs with proper field names and JSON tags
Use this JSON to Go generator to create Go structs with JSON tags from JSON samples for APIs and services.
Step 1 – Paste a JSON sample
Import to load JSON from a file, URL, or sample data.Step 2 – Choose Go struct options
Struct Name (for example Root).*string, omitempty, or custom types).json:"createdAt").Step 3 – Review the generated code
Root Type Name, null handling, and frameworks if available.Step 4 – Use the structs in Go
gofmt.encoding/json into the root type.Step 5 – Copy or download
Quick tips
time.Time only when you control the timestamp format.// JSON input
{
"id": 123,
"name": "Maeve Winters",
"email": "maeve@example.com",
"active": true,
"roles": ["admin", "editor"],
"metadata": { "plan": "pro" },
"createdAt": "2024-03-01T10:15:00Z",
"score": 99.5,
"notes": null
}
// Generated Go structs (simplified)
type Metadata struct {
Plan string `json:"plan"`
}
type Root struct {
ID int `json:"id"`
Name string `json:"name"`
Email *string `json:"email"`
Active bool `json:"active"`
Roles []string `json:"roles"`
Metadata Metadata `json:"metadata"`
CreatedAt string `json:"createdAt"`
Score float64 `json:"score"`
Notes any `json:"notes"`
}Explore more JSON and schema tools that work great alongside this JSON to Go generator.
Convert existing Go structs into JSON examples and JSON Schema for docs and validation.
Generate a JSON Schema from JSON samples to validate payloads and contracts.
Format and validate JSON before generating structs to avoid runtime issues.
Generate Rust structs with serde when you want strict typing.
The generator creates Go structs with proper field names, JSON tags for marshaling/unmarshaling, and appropriate Go data types following Go naming conventions.
The generator automatically adds JSON tags to struct fields for proper serialization. You can also enable YAML or XML tags if needed for multi-format support.
Yes! You can specify any package name in the options. The default is 'main' but you can use your own package names like 'models', 'types', etc.
The generator automatically converts JSON field names to proper Go field names (PascalCase for exported fields) while preserving the original names in JSON tags.