Webhook HMAC Signer
Sign and verify GitHub, Stripe, and Slack webhook signatures locally.
OpenGet typed dataclasses for a JSON payload so your editor and type checker can help.
Use a sample with typical values filled in.
Fields get type hints and nested classes come first.
Rename keyword fields and tighten Optional[Any].
Copy the module or download the file.
A data pipeline script passes API responses around as raw dictionaries, and a misspelled key has silently produced empty reports for a week. Moving to dataclasses with type hints makes that kind of mistake visible, and generating them from a sample response is the fastest way to start.
Paste a JSON object and each object inside it becomes a @dataclass with annotated fields. Strings map to str, whole numbers to int, other numbers to float and booleans to bool. Lists become List[T] from their first item, an empty list becomes List[Any], a null value becomes Optional[Any], and each nested object becomes its own class, defined above the class that uses it so the module imports cleanly. Only the typing names actually used are imported. Copy the result or download it as model.py.
Dataclasses do not convert nested dictionaries for you. Root(**json.loads(text)) builds the outer object but leaves nested values as plain dicts, so write a small from_dict helper or use a library such as dacite or pydantic when you need deep conversion. Keys that are not valid identifiers have their invalid characters replaced with underscores, and keys that are Python keywords, such as class or from, need renaming by hand. For a schema you can validate against at runtime, the JSON Schema generator works from the same sample, and the JSON to TypeScript converter covers the frontend side.
The conversion runs entirely in your browser, which suits samples taken from internal systems.
Keyboard shortcut
Answers for this tool. For site-wide help, open the FAQ hub.
No, the output is standard library dataclasses only. Converting to Pydantic is mostly a matter of inheriting from BaseModel and removing the decorator.
A null tells the generator the field can be empty but not what type it holds when filled. Replace Any with the real type, so a nullable name field becomes an optional str.
Yes. It uses List and Optional from the typing module rather than the newer built-in generic syntax, so it runs on Python 3.7 and later, where dataclasses are available.