Paste a sample of the JSON and generate matching Go struct definitions: exported field names, inferred types, nested structs for nested objects, slices for arrays, and json tags mapping each field back to its original key. A browser-based JSON to Go converter does this instantly on your own device, so API payloads are never pasted to a server.
Free JSON to Go struct converter. Generate typed Go structs with json tags from a JSON sample, inferring nested types, slices and field names.
Open JSON to Go Struct → Free toolFree JSON to TypeScript converter. Generate a typed interface from a JSON sample, inferring nested objects, arrays and optional fields automatically.
Open JSON to TypeScript →Go field names must be exported (capitalized) to be visible to the encoding/json package, but JSON keys are usually lowercase or snake_case. The json tag bridges the two: a field declared as UserName string with the tag json:"user_name" unmarshals correctly. A generator writes all of this for you from a sample payload, inferring numbers, strings, booleans, nested structs and slices, which removes the most tedious and typo-prone part of wiring up an API client.
Generation works from the one sample you provide. A field that happens to be null in the sample, or an optional field missing from it, cannot be typed with certainty, so skim the output and adjust types where you know the API contract better than the sample shows. The same workflow exists for TypeScript if the other side of your stack needs interfaces from the same payload.
Real API responses contain real data. The conversion runs entirely in your browser, so the sample payload is never transmitted anywhere.
Yes. Nested objects become nested struct types and arrays become slices, inferred from the sample.
Go only exports capitalized fields to the JSON package, and the json tag keeps the mapping to the original lowercase key.
No. The conversion runs entirely in your browser.