JSON to Go Structs
Generate Go structs from JSON with proper json tags, embedded structs, and omitempty support. Ready to paste into any Go project.
Output will appear here…Generate Go structs from JSON
Go structs need JSON tags to control how theencoding/json package maps JSON keys to Go fields. Writing those tags by hand is tedious and error-prone — every field needs a tag, the tag needs the original JSON key, and you have to remember whether to add omitempty. Lintify generates the struct and the tags from a sample JSON document, ready to paste into your Go project.
Go field names must be exported (start with an uppercase letter) to be visible to the json package. Lintify converts each JSON key to PascalCase and adds ajson tag that preserves the original key. For example, the JSON key userId becomes the Go field UserId with the tagjson:"userId".
When to use omitempty
omitempty causes the encoder to skip a field if it has its zero value. This is useful for PATCH endpoints where you only want to send fields the client explicitly set. For full responses, leaveomitemptyoff so that zero values are serialized explicitly — the consumer can then distinguish between "field is zero" and "field is missing".
Pointers for nullable fields
By default, Lintify uses value types and lets the zero value represent missing data. If you need to distinguish between a missing field and a field that is present with the zero value, enable the pointer option — every field becomes *T. Pointers add nil-checks at every use site, so only enable them when you really need the distinction. Most APIs do not need this.
Numbers, integers, and json.Number
Integers become int (or int64for large values), decimals become float64, and very large integers (over int64.MaxValue) become json.Number so that no precision is lost. json.Number is a string type that lets you decide later whether to parse as int64 orfloat64 — useful when you do not know in advance how big the numbers will be.
Frequently asked questions
Common questions about the JSON → Go tool.