Typed Go code. Generated in your browser.

JSON to Go Struct Generator

Turn JSON objects and arrays into exported Go types, nested structs, and slices. No uploads, dependencies, or accounts.

Go struct options

Ready. Your JSON stays in this browser.

Processing stays in this tab. No JSON is uploaded or sent to a parser service. Merger transfers use temporary tab storage and are removed as soon as they load.

Generate Go structs from a JSON sample

Paste valid JSON, choose a root type name, and copy or download the generated .go file. Names such as user_id become UserID, and json tags retain the original JSON keys. The file uses package main; change the package declaration to match your project.

Nested objects and arrays

Nested objects become named child structs. Arrays become slices; object arrays are inferred across every item. Missing fields use pointers, and integers mixed with decimals become float64. Root arrays generate a named slice type rather than an artificial wrapper object.

Nulls, empty arrays, and sample limitations

A null alongside a known scalar or object produces a pointer. Null-only values, empty-array items, and mixed incompatible types use interface{} because a sample cannot establish a stronger type. Integers use int64, fractional numbers use float64, and unsafe numbers produce an error rather than silently losing precision. Go names are normalized to exported ASCII identifiers with collision-safe suffixes.

Struct tags cannot faithfully represent every possible JSON key; unsupported names show a clear error when tags are enabled. Disabling tags may require custom field mapping. The omitempty option controls marshaling of empty values, not validation. Review generated types against your API schema and run gofmt in your project.

JSON Merger · JSON to TypeScript · JSON to Zod · JSON to TOML · JSONC / JSON5 Formatter