ToolBuddy
In Browser

JSON to Go

Infer Go structs from a JSON sample. Nested objects become named struct types with exported fields and json tags. Keys missing from some objects in an array are optional. Conversion stays in the tab.

Runs in your browser. Nothing is uploaded.

0 characters · 0 lines

0 characters · 0 lines

About this tool

Infer Go structs from a JSON sample. Objects become named struct types with exported fields and json tags. Keys missing from some objects in an array are optional pointers. A JSON null next to a concrete value becomes a pointer too. Whole numbers stay int. Other numbers become float64.

How to use: paste JSON, copy the types. A root array of objects is type Root []RootItem. Empty objects become map[string]any and empty arrays become []any. This is a starting point, not methods, enums, or validation tags.

Example: {"id":1,"name":"Ada","address":{"city":"London"}} yields type Root and type Address. Related: JSON to TypeScript for interfaces, JSON to Code for JS, Python, or PHP literals.

The sample stays in the tab. Nothing is uploaded. After the page loads, conversion works offline.

FAQ

Related Convert tools