JSON to Go Struct
Generate Go structs from JSON. Free, instant.
{var t=typeof o[k];var goT=t==='number'?(Number.isInteger(o[k])?'int':'float64'):t==='boolean'?'bool':'string';var name=k.charAt(0).toUpperCase()+k.slice(1);r+='\\t'+name+' '+goT+' `json:\"'+k+'\"`\\n'});return r+'}'}catch(e){return 'Invalid JSON'}"}'>
How to Use JSON to Go Struct
1
Paste JSON.
2
Get Go struct.
3
Copy or download your result.
Frequently Asked Questions
Does it handle arrays?
Basic types. For complex structures, review and adjust.