Free dev tools
JSON → Apex DTO Generator
Generate Apex inner classes from a JSON sample. Each nested object becomes its own class; array element types are inferred.
JSON
Apex
Output appears here.Related dictionary terms
Keep building
About this tool
When you call an external REST API from Apex, you typically deserialize the response into a typed inner class with `JSON.deserialize`. Writing those classes by hand from a sample response is mechanical and error-prone. This generator takes a JSON sample, walks the structure, and emits an Apex outer class with one inner class per nested object - types inferred from the values you provide.
The generator parses your JSON sample, recurses into each object, and produces a strongly-typed Apex class. Numbers become `Decimal` (or `Integer` if no fractional part is present anywhere in the sample), booleans become `Boolean`, strings become `String`, arrays infer their element type from the first element, and nested objects each become their own inner class with PascalCase names derived from the JSON key. The output is paste-ready into an Apex class file.
- Bootstrapping a typed Apex DTO for a third-party REST response (Stripe, HubSpot, Twilio, etc.).
- Generating fixtures for an Apex test class that calls a mocked HTTP endpoint.
- Documenting the shape of a webhook payload as part of an integration spec.