JSON to Go
Paste a JSON response and get Go structs you can paste straight into a file. Fields that are optional or nullable become pointers, so you keep the difference between absent, null and the zero value.
Output appears here as you type.
Runs entirely in your browser. Nothing you paste here is uploaded or stored.
Questions
Is my JSON uploaded anywhere?
No. Inference and code generation run entirely in your browser. Nothing is sent to a server, so pasting a real API response with customer data or internal URLs is safe.
Should I paste one object or an array of them?
An array, whenever you have one. Every element is merged into a single shape, so a field that is missing from some records becomes optional and a field that is sometimes null becomes nullable. One object can only ever tell the generator that everything is required.
Why does this produce different types than other converters?
Because every element of the array is merged before anything is generated. A converter that reads only the first record cannot know that a field is missing from later ones, or that it is sometimes null, so it emits a plain non-nullable type. In a statically typed language that is not a cosmetic difference: it is the line between a clean decode and a nil dereference at runtime.
Why are some fields pointers?
Because a plain string cannot represent absence. If the API omits a field, or sends null, a string field silently decodes to "" and your code cannot tell that apart from an empty value the server really sent. A *string can. Only fields that were actually missing or null in your sample get one, so the output does not turn into pointers everywhere.
Why is it ID and not Id?
Go convention capitalises initialisms whole - ID, URL, API, HTTP, UUID - and linters flag the alternative. The generator applies the same list golint used, so an api_url key becomes APIURL rather than ApiUrl.
Do I need to run gofmt on the output?
No. The field name, type and tag columns are aligned exactly as gofmt would align them, which is checked against the real gofmt binary in this project’s tests.
More code generation tools
JSON → TypeScript
Generate named interfaces, with optionals and nullability inferred from every sample.
JSON → Zod
Generate a Zod schema, with formats, enums and optionals already applied.
JSON → JSON Schema
Generate a draft 2020-12 or draft-07 schema with $defs and required arrays.
JSON → C#
Generate C# classes or records with nullable annotations and serializer attributes.
JSON → Python
Generate Pydantic models or dataclasses, with aliases and correct field ordering.