JSON to Dart

Paste a JSON sample and get null safe Dart classes with fromJson and toJson methods ready for your Flutter app.

Generate Dart classes from JSON

Classes: 0 · Fields: 0 · Lines: 0
Paste a JSON object or array and press Generate Dart.
Each class gets a fromJson factory and a toJson method. List fields are mapped with a loop, so nested objects and lists are converted in both directions.

How to use the JSON to Dart

  1. Paste a JSON object or array into the sample box, or press Load sample to try one.
  2. Set the root class name and choose how nullable fields should be handled.
  3. Press Generate Dart and copy the classes, then call fromJson on the decoded response.

Features

Advertisement

Frequently Asked Questions

Common questions about the free online json to dart.

Paste a JSON sample, set the root class name and press Generate Dart to get null safe classes with fromJson and toJson.
Yes. Every nested object and every list of objects becomes its own class, named after the key that holds it.
A field becomes nullable when the sample value is null, and the constructor makes those parameters optional instead of required.
Numbers become double, true and false become bool, text becomes String, lists become List and objects become nested classes.
Nested classes expose their own toJson method, and lists are mapped with a call to toJson on each element.
Yes. The classes are plain Dart with no dependencies, so they work in any Flutter or server side project.
Run jsonDecode on the response body and pass the map to the root fromJson factory, as shown in the comment at the end.
A JSON sample cannot tell an integer from a decimal, so double is used and you can switch fields to int where you know better.
Yes. It is free, needs no sign up and never uploads the JSON you paste into the box.

Last updated: October 10, 2026