Paste your Go struct definition and instantly get a JSON representation with sample values. Supports struct tags, nested structs, arrays/slices, and all Go primitive types.
Paste your Go struct definition and instantly get a JSON representation with sample values. Supports struct tags, nested structs, arrays/slices, and all Go primitive types.
Common questions and answers about this topic.
A Go struct defines a typed data structure with named fields, while JSON is a text-based data format. Go's encoding/json package maps struct fields to JSON keys using field names or json struct tags. This converter generates sample JSON output that matches your struct definition.
The converter reads json struct tags to determine the JSON key name. For example, a field with `json:"user_name"` will appear as "user_name" in the JSON output. Fields tagged with `json:"-"` are omitted. If no json tag is present, the field name is used as-is.
Yes, the converter fully supports nested struct definitions, slices of structs, maps, and embedded structs. Each nested struct is converted to a corresponding nested JSON object with appropriate sample values for each field type.
No, the Go struct to JSON conversion runs entirely in your browser. Your Go struct definitions are parsed locally with JavaScript and never sent to any server.