JSON-to-Go is a small browser-based tool that takes a JSON snippet you paste in and converts it into a Go type definition automatically. JSON is a common data format used by APIs, and Go is a programming language that requires you to define the shape of your data before you can work with it. Writing those type definitions by hand is tedious, so this tool does it for you in the browser without any setup or account needed. You paste your JSON on one side and the corresponding Go struct appears on the other side instantly. The tool makes reasonable guesses about types when the JSON is ambiguous, so it recommends giving the output a quick look before using it in your code. For arrays of objects, it assumes the first item in the array is representative of all the others. It can also be run from the command line using Node.js if you prefer to pipe JSON files through it as part of a script or workflow. A companion tool called curl-to-Go handles converting curl commands into Go code, and comes from the same author. The README is brief, and the project is intentionally simple in scope.
← mholt on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.