Go → JSON
Convert Go struct/map fmt.Printf output to JSON
Input0
Examples:
Output
0
About Go to JSON Converter
Convert Go fmt.Printf struct and map output to standard JSON. Supports four common formats:
1. %+v format — e.g., {Name:John Age:30}, Go's default format with field names, most commonly used in log debugging.
2. Struct type definition — e.g.,
type UserDTO struct { ... }, generates a JSON schema example directly from the struct definition.
3. %#v format — e.g., main.User{Name:"John", Age:30}, Go's verbose syntax format with package name and type.
4. map output — e.g., map[string]interface{}{key:value}, Go map print output.
The tool auto-detects the input format, supports nested structs, slices, pointers (&{...}), and more. Perfect for backend developers quickly analyzing data from Go service logs.Frequently Asked Questions
What Go output formats are supported?▼
Three formats are supported: %+v {Key:Value} format, %#v pkg.Type{Key:Value} format, and map output format. The tool auto-detects the input type.
Can it handle nested structures?▼
Yes, it recursively parses nested structs, slices (e.g., [1 2 3]), maps, and pointer references (e.g., &{...}).
Can I paste log lines directly?▼
Yes, you can paste Go fmt.Printf or log.Printf struct output directly.