JSON to Apex Generator
Paste a JSON payload and generate strongly-typed Apex wrapper classes, @AuraEnabled properties, or an @IsTest skeleton—automatically.
About JSON to Apex Class Generator
When integrating Salesforce with external APIs, you constantly receive JSON payloads that need to be deserialized into typed Apex objects. Writing wrapper classes by hand is tedious and error-prone — especially for deeply nested structures. This tool generates the complete Apex class hierarchy from any JSON sample, including inner classes, @AuraEnabledannotations for LWC, and a test class skeleton.
What this tool generates
Standard Wrapper Classes
Public Apex classes with typed properties matching your JSON structure. Nested objects become inner classes. Arrays become List<T> properties.
@AuraEnabled Classes
Same structure with @AuraEnabled on every property — ready to return from an Apex controller to a Lightning Web Component or Aura component.
Test Class Skeleton
An @isTest class that instantiates the wrapper, serializes it, and deserializes it back — a starting point for verifying JSON round-trip correctness.
Type Inference
Automatically infers String, Integer, Decimal, Boolean, List<T>, and nested object types from your JSON values.
Usage pattern
Paste a sample JSON response from your external API, click Generate, copy the Apex class, and paste it into your Salesforce org. Then call MyClass obj = (MyClass) JSON.deserialize(responseBody, MyClass.class); in your callout handler.
Pipeline
- JSON Formatter — validate and pretty-print your JSON before generating classes.
- JSON to TypeScript — generate TypeScript interfaces for the same payload for your LWC JavaScript.
- SOQL Builder — query the Salesforce objects you're mapping to.
Frequently asked
- Is my JSON data sent to a server?
- No. All Apex class generation runs 100% in your browser. Your JSON payloads — including any sensitive field values — never leave your device.
- What is the difference between Standard and AuraEnabled output?
- Standard output generates plain Apex wrapper classes with public properties. AuraEnabled output adds @AuraEnabled annotations to every property, making the classes directly usable as return types in Lightning Web Component (LWC) and Aura component Apex controllers.
- How does the tool handle nested JSON objects?
- Nested objects are converted to inner classes within the parent wrapper. For example, a JSON object with a nested "address" object generates an Address inner class and a property of that type on the parent class.
- Can I use the generated classes with JSON.deserialize?
- Yes. The generated classes are designed to work with JSON.deserialize(jsonString, MyClass.class) and JSON.deserializeStrict(). Property names match the JSON keys exactly so deserialization works without a custom parser.
- What does the test class output include?
- The test class output generates an @isTest class with a test method that creates a sample instance of the wrapper, serializes it to JSON, and deserializes it back — verifying round-trip correctness.