$devtoolkit.sh/tools/json-to-go-struct

JSON to Go Struct

Convert JSON to Go struct definitions with json tags.

$json input
0 chars1 lines
$go structs[READY]
0 chars1 lines

Related Tools

FAQ

How are field names converted?
JSON keys are converted to PascalCase for the Go field name while the original key is preserved in the json struct tag, e.g., `MyField string \`json:"my_field"\``.
How are nested objects handled?
Each nested JSON object generates a separate Go struct. The parent struct references the child struct by its PascalCase name.
What Go types are used for JSON values?
Strings map to string, numbers to float64, booleans to bool, null to *interface{}, arrays to slices, and objects to named structs.

Paste a JSON object and generate idiomatic Go struct definitions. Field names are converted to PascalCase, json struct tags are added automatically, and nested objects become separate named structs. The top-level struct is named Root.

/tools/json-to-go-structv1.0.0