JSON to Go
Generate a Go struct from JSON.
How to use JSON to Go
JSON to Go — Build a Go type from a JSON sample, with json tags that match the keys you pasted. Free to use in D2i DevTools — no account required.
Steps
- Fill in JSON. This field is required.
- Click Run and copy the result under the form.
Frequently asked questions
What is JSON to Go used for?
Use it to start a struct for an API response instead of typing every field.
How do I use the free online JSON to Go tool?
Fill in JSON. This field is required. Click Run and copy the result under the form.
What can I paste or upload into JSON to Go?
Paste one JSON value. Objects become structs. Arrays use the type of the first element.
What output does JSON to Go give me?
Go source that starts with type Root. Numbers without a decimal become int. Empty arrays become []any.
Is JSON to Go free, and is my input private?
Yes — Your input is processed in memory for this request only. It is not saved to disk or the database, and it is cleared after the tool finishes.
Will this compile for every API?
It is a starting point from one sample. A field that is sometimes null or sometimes an object may need a wider type.
Inputs are processed in memory only and are not saved to disk or the database. Data exists only for the duration of your request.