Free JSON to Dart Converter Online
Convert JSON to Dart classes for Flutter instantly. Supports JsonSerializable and null safety.
JSON Input
Dart Output
What Is JSON to Dart?
Every Flutter developer hits the same wall: you get a JSON API response and now you need Dart classes with the right field names, types, and serialization methods. Writing them by hand for a deeply nested payload is tedious and error-prone. This tool reads your JSON and generates typed Dart classes instantly — including fromJson/toJson via json_serializable on pub.dev if you enable it. The dart.dev JSON guide and dart:convert library cover the runtime side. The JSON specification on json.org defines the input format. Everything runs in your browser — nothing is sent to any server.
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 List<T>. 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.