How to use JSON to Dart
- 1
Open JSON to Dart
Go to tools.slaytic.com and open the JSON to Dart tool. No sign-up or account required.
- 2
Paste your JSON and name the class
Paste one JSON object, or an array of sample objects, and set the root class name.
- 3
Copy or download your Dart model
Click Generate to get a complete Dart file with typed fields, a constructor, and fromJson/toJson. Copy it or download it as a .dart file.
How this works in your browser
This tool infers a schema from your JSON directly in your browser, no external Dart tooling or build_runner involved. It walks every sample you provide, merges the shape of each field across all of them, and marks a field nullable only if it was ever missing or null in at least one sample. Nested objects and lists of objects each become their own generated class, and the output is plain, dependency-free Dart you can paste straight into a project.
JSON to Dart vs. traditional online converters
| Feature | JSON to Dart (in-browser) | Traditional online converters |
|---|---|---|
| File upload required | No - never leaves your device | Yes - file is sent to a server |
| Processing queue | None - starts instantly | Often, especially at peak times |
| Watermark on output | Never | Common on free plans |
| Usage limits | None - free, unlimited use | Often capped per day or file size |
| Works offline once loaded | Yes, for most tools | No - requires a live connection |
| Account required | No | Often, for anything beyond a trial |
Who uses JSON to Dart
Flutter and Dart developers
Turn a sample API response into a working model class in seconds, instead of hand-writing fields and a fromJson parser.
Prototyping against a real API
Paste a real response from the API you are integrating with and get types that actually match the data, not a guess.
Catching optional fields early
Paste a few different real samples from the same endpoint to see exactly which fields are sometimes missing, so your model marks them nullable instead of crashing on the one response that omits one.
Frequently asked questions
Is this JSON to Dart converter free?
Yes, completely free with no limit on how many times you use it.
Will the generated Dart actually compile?
Yes, for typical JSON shapes: it produces null-safe fields, a constructor, and matching fromJson/toJson methods with no external package required. Very irregular or deeply mixed-type data may need a small manual touch-up.
How does it decide if a field is nullable?
If you paste an array of sample objects, a field is marked nullable if it was missing or null in any one of them. With a single object, a field is only nullable if its value is literally null.
What happens with nested objects and lists?
Each nested object, and each list of objects, gets its own generated Dart class with its own fromJson/toJson, referenced from the parent class.
What if a field has mixed types across samples?
A field that is sometimes a number and sometimes a string, for example, is typed as dynamic rather than guessing one type that could fail to compile against real data.
Is my JSON sent anywhere?
No, the entire conversion runs inside your browser.