Convert JSON to Go structs with encoding/json tags
Paste JSON and get Go structs back instantly. Field names are exported in PascalCase while a struct tag preserves the original JSON key, so the result works directly with encoding/json. Nested objects become their own structs and the time import is added when a timestamp is detected.
Output format: Struct + JSON tags — Exported fields with `json:"..."` tags for encoding/json.
| Option | What it does |
|---|---|
| Root Struct Name | Names the top-level Struct. |
| Package Name | Emitted as the package clause at the top of each file. |
| Field Naming Convention | One of PascalCase, camelCase, Preserve Original. Defaults to PascalCase. |
| Type for null values | Either interface{} or string, used when a key is null in every sample. |
| Add ,omitempty | Append ,omitempty to each JSON tag so zero-valued fields are skipped when marshalling. |
| JSON value | Go type |
|---|---|
| string | string |
| integer | int |
| integer beyond 32 bits | int64 |
| decimal | float64 |
| true / false | bool |
| ISO-8601 timestamp | time.Time |
| array | []T |
| object | nested struct |
| null | interface{} (configurable) |
{
"id": 12345,
"product_name": "Wireless Mouse",
"price": 24.99,
"in_stock": true,
"tags": ["electronics", "accessories"],
"manufacturer": {
"name": "Acme Corp",
"country": "US"
}
}
package main
type Product struct {
Id int `json:"id"`
ProductName string `json:"product_name"`
Price float64 `json:"price"`
InStock bool `json:"in_stock"`
Tags []string `json:"tags"`
Manufacturer Manufacturer `json:"manufacturer"`
}
Go only marshals and unmarshals exported fields, meaning ones whose names start with a capital letter. The generator capitalizes every field for that reason and puts the original JSON key in the struct tag, so product_name in your JSON maps to a ProductName field.
It appends ,omitempty to each json struct tag, which tells encoding/json to leave a field out of the output when it holds its zero value — an empty string, 0, false, or a nil slice. Useful for compact payloads, but it makes a genuine zero indistinguishable from an absent field.
No. Parsing, type inference, and code generation all run in your browser using JavaScript. Your JSON is never sent to a server, and there is no account, tracking, or storage beyond your own browser.
No. The generator is free to use with no sign-up and no usage limits.
Each nested JSON object becomes its own named type, derived from the key it appeared under. Arrays of objects are widened across every element, so a field that is a whole number in one element and a fraction in another gets a type that holds both.