Generate a Dart class with fromJson/toJson from a JSON sample. Part of the DevTools Surf developer suite. Browse more tools in the Converters collection.
Use Cases
Flutter developers integrating REST APIs with type-safe models
Mobile teams sharing data classes between iOS and Android via Flutter
Dart backend developers building shelf or dart_frog server applications
Freelancers rapidly prototyping Flutter apps from existing API documentation
Tips
Generated classes include fromJson factory and toJson method for Flutter use
Nested JSON produces separate Dart classes with proper type references
Use the output with Flutter's http package for type-safe API calls
Fun Facts
Dart was originally launched by Google in 2011 as a replacement for JavaScript, but found its true success as the language behind Flutter starting in 2017.
Flutter's hot reload feature can reflect Dart code changes in under 1 second, making fromJson/toJson classes immediately testable during development.
Dart compiles to ARM machine code for mobile, JavaScript for web, and x86 for desktop — all from the same codebase and the same data classes.
FAQ
Does it generate fromJson/toJson?
Yes — both factory constructors. The generated class round-trips JSON losslessly for the fields the sample documented.
Null safety support?
Yes — assumes Dart 2.12+ sound null safety. Nullable fields (those sometimes missing in the sample) become `String?`, non-nullable become `String`.
What about deep nesting?
Each nested object becomes its own class. The tool names them by key (a `user` object becomes class `User`). Rename in your code to match your conventions.
Flutter-compatible?
Yes — the output is plain Dart with no Flutter-specific imports. Drop into any Flutter project.