Webhook HMAC Signer
Sign and verify GitHub, Stripe, and Slack webhook signatures locally.
OpenPaste a payload and get structs that json.Unmarshal can fill.
Use one JSON object that reflects the real payload.
Fields get exported names and json tags.
Rename the package, add omitempty or pointers.
Copy the code or download the file.
A Go worker needs to consume events from a queue, and the producer team sent a sample message rather than a schema. Generating structs from that message gets you to a compiling json.Unmarshal call in a minute instead of twenty.
The output starts with package main and declares one struct per JSON object. Field names are converted to exported PascalCase (created_at becomes CreatedAt), and each field has a json tag with the original key, so decoding works without renaming anything in the payload. Integers map to int, other numbers to float64, booleans to bool and strings to string. Arrays become slices typed from their first element, nested objects become their own named structs, and an empty array becomes []interface{}. Copy the result or download it as model.go.
Review the output before committing it. Change package main to your package name. The tags have no omitempty, so add it where you encode structs and want zero values left out. A null in the sample is typed as string; use a pointer such as *string for fields that can be null. Initialisms are not uppercased the Go way, so user_id becomes UserId rather than UserID, which Go linters commonly flag. To make sure the sample is valid first, open the JSON syntax validator, and if the producer publishes a JSON Schema, compare it with what the schema generator infers from the same message.
Struct generation happens locally in the page, which keeps internal event formats on your machine.
Keyboard shortcut
Answers for this tool. For site-wide help, open the FAQ hub.
Every whole number is typed int. On 64-bit platforms int is 64 bits wide, but if you build for 32-bit targets or want the size explicit, change it to int64.
As string, because JSON has no date type. Change the field to time.Time if the value is in RFC 3339 format, which encoding/json parses automatically.