Loading…
Generate Go structs with json tags from JSON. Use for Go only; for TypeScript use json-to-typescript. Input: JSON ≤10MB. Returns Go code or JSON error. 100% client-side.
JSON to Go Struct is loading — interactive editor will appear here. Use examples below to try instantly once loaded.
Press ? for keyboard shortcuts
Generates Go struct definitions from JSON input, creating nested structs, arrays, and maps with proper Go types. Supports custom JSON tags in snake_case or camelCase, omitempty for optional fields, and "inline" flattening for embedded structs.
Manually writing Go structs for complex JSON APIs is tedious and error-prone, especially with deeply nested objects. Automates the mapping between JSON schemas and Go type definitions, saving development time and reducing bugs.
This tool is part of the DevStackIO platform — a collection of free online developer tools from DevStackIO. Browse more free developer resources on DevStackIO.
Go developers working with REST APIs, microservices, or any JSON-based data interchange who need to quickly scaffold struct definitions.
Paste your JSON input into the editor; the tool auto-detects and parses the structure
Toggle struct options: JSON tags (snake_case/camelCase/disabled), omitempty for optional fields, and "inline" for flattening nested objects
Set the package name (default "main") and optionally enable exporting types (uppercase first letter)
Configure type preference for numbers (float64 vs int) and time fields (string vs time.Time)
Click "Generate" and review the output; nested objects become separate struct types with proper references
Copy the generated Go code to your editor or use the "Copy" button; refine by adjusting options and regenerating
Input: {"name":"Alice","age":30,"address":{"city":"NYC"}} -> Output: type Address struct { City string `json:"city"` }\ntype Person struct { Name string `json:"name"` Age int `json:"age"` Address Address `json:"address"` }Input: {"metadata":{"created":"2024-01-01T00:00:00Z"}} with timeType=time.Time -> Output: type Metadata struct { Created time.Time `json:"created"` }Does it support nested objects?
Yes, each level of nesting becomes its own struct type with proper Go composition.
Can I generate time.Time fields for date strings?
Yes, toggle the timeType option to convert matching patterns to time.Time instead of string.
What about nullable fields?
Enable omitempty to mark fields as optional, and null values in JSON will be represented as pointer types where appropriate.
Does it generate JSON tags with dashes or underscores?
You can choose between snake_case, camelCase, or disable JSON tags entirely.
Authoritative specifications, standards, and in-depth reading for JSON to Go Struct.
Generate code types from JSON. Use for boilerplate; for TS only use json-to-typescript, for Go use json-to-go. Input: JSON ≤10MB. Returns code. 100% client-side, files never leave browser.
Generate TypeScript interfaces from JSON with optional readonly and export. Use for TS types; for Go use json-to-go, for generic code use json-to-code. Input: JSON ≤10MB. Returns .ts interfaces or JSON error. 100% client-side.
Extract HTML tables to JSON arrays for scraping. Use for <table> input only; for CSV to JSON use csv-to-json. Input: HTML with tables ≤10MB. Returns JSON array or NO_TABLE_FOUND error. 100% client-side.
Convert between TOML, JSON, and YAML in any direction. Use for multi-format configs; for single-pair JSON-YAML use json-to-yaml. Input: TOML/JSON/YAML ≤10MB. Returns converted text or parse error. 100% client-side.
Shows Unicode code points, names and UTF-8 bytes for any text. Use when debugging encoding issues; differs from nato-alphabet by code points vs phonetic words. Returns per-character table with escapes. 100% client-side.
Spells numbers as English words with currency and ordinal options. Use for cheques, invoices or legal text; differs from text-to-unicode by words vs code points. Returns word form and copy-ready text. 100% client-side.
Spells text as NATO phonetic words (Alpha, Bravo, Charlie). Use when dictating over calls; differs from text-to-unicode by spoken words vs code points. Returns phonetic transcription. 100% client-side.
Convert Unix timestamps to readable dates and back. Supports timezones and multiple formats.