JSON to Dart Converter
Convert JSON to Dart classes online. Generate json_serializable classes for Flutter and Dart development. Free, runs in your browser—no data sent to servers.
JSON Input
Dart Output
What Is JSON to Dart?
Dart uses classes for structured data. When you consume JSON in Flutter or Dart apps, you need matching classes with the right field names and types. The JSON specification defines objects, arrays, strings, numbers, and booleans—but Dart needs explicit class definitions for each nested object.
This tool generates Dart classes from your JSON. Enable JsonSerializable for fromJson/toJson methods. Enable Nullable Types for optional fields. The output works with json.decode() and json.encode().
Conversion runs entirely in your browser. Your JSON is never sent to a server.
When JSON to Dart Helps
When building Flutter or Dart apps that consume REST APIs, you need typed classes. Paste a sample response here to generate matching classes.
How to Use This Tool
Paste or Upload JSON
Copy your JSON and paste it into the left editor. You can also click Upload to load a file. Use the Sample button for example data. Set the class name and options in the config panel.
Review the Generated Classes
The right panel shows the generated Dart classes. Nested objects become separate classes. Arrays become <code>List<T></code>. If your JSON has invalid syntax, fix it first using the JSON Formatter or JSON Validator.
Copy or Download
Use Copy or Download to get the code. Paste into your Flutter or Dart project.
JSON to Dart Examples
Here is an example of generating Dart classes from a JSON object.
Example: Subscriber record
JSON input:
Generated Dart output:
When JSON to Dart Helps
Most developers need this when integrating with REST APIs. Pasting it here gives you typed classes you can use immediately with json.decode.
If you need to merge two JSON files first, there's a separate JSON Merge tool for that.
Database exports, config files, or API responses are often JSON. Running them through here helps you generate Dart classes for your app.
Frequently Asked Questions
JsonSerializable or manual fromJson?
JsonSerializable generates fromJson and toJson at build time. It reduces boilerplate. Requires json_serializable and build_runner in your project.
What about null safety?
Enable Nullable Types for optional JSON fields. This adds ? to types that can be null.
Is my data sent anywhere?
No. Generation runs entirely in your browser. No data is sent to any server.
Can I use this with Flutter?
Yes. The generated classes work with Flutter's http package and dart:convert. Add json_serializable for automatic serialization.
What if my JSON keys use snake_case?
Dart typically uses camelCase. Use @JsonKey(name: 'json_key') on the field for custom JSON key names.
Related Tools
For Dart JSON, see dart:convert. For JSON, see the JSON specification. For Flutter, see Flutter.