JSON to Dart Converter
Paste a JSON object and get Dart classes for Flutter or Dart projects — including `fromJson` factory constructors and `toJson` methods.
Last updated: May 27, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is JSON to Dart Converter?
Flutter and Dart developers typically write a model class per JSON response, with a `fromJson` factory constructor for deserialization and a `toJson` method for serialization. Writing both directions by hand is mechanical work that scales poorly with the number of endpoints.
This tool generates the full pattern: field declarations with inferred types, a constructor with named parameters, a `fromJson(Map<String, dynamic>)` factory, and a `toJson()` method that mirrors the field names back to a map. Nested objects produce their own classes with their own conversion methods, so deeply nested API responses come out fully typed.
How to Use JSON to Dart Converter
Paste a JSON object (root must be an object).
Set the root class name.
Toggle final fields, nullable types, and fromJson/toJson generation.
Copy the generated classes into your project.
Common Use Cases
- Generating Flutter model classes from REST API responses.
- Bootstrapping data classes for json_serializable migration.
- Quick scaffolding for a Dart CLI that consumes JSON.
- Producing a starting point that you refine with package:freezed or similar.
Example Input and Output
A flat JSON object generates a Dart class with fromJson and toJson.
{ "userId": 42, "name": "Alice", "active": true }class Root {
final int? userId;
final String? name;
final bool? active;
Root({this.userId, this.name, this.active});
factory Root.fromJson(...) { ... }
Map<String, dynamic> toJson() { ... }
}Privacy
All conversion happens in your browser. No JSON is sent to a server.
Lists of primitives
List<int>, List<String>, etc. use .cast<T>() in fromJson to safely convert from List<dynamic>. List<NestedClass> uses .map((e) => NestedClass.fromJson(e)).toList().

