JSON to Dart

Paste JSON and instantly get matching Dart model classes with fromJson/toJson factories and nullable-safe fields.

Input JSON

Dart Output

Paste JSON and click Generate

Copied!

Summary

Paste JSON and instantly get matching Dart model classes with fromJson/toJson factories and nullable-safe fields.

How it works

  1. Paste or type JSON into the input panel, or load a sample.
  2. Set a root class name (defaults to RootObject).
  3. Click Generate to parse the JSON and build Dart model classes.
  4. Nested objects become their own named classes; arrays of objects are scanned across all items to detect optional fields.
  5. Fields that are missing from some items, or that hold null, become nullable properties.
  6. Click Copy to copy the Dart code to your clipboard.

Use cases

  • Scaffold model classes for a REST API response before wiring up an http or dio call in Flutter.
  • Turn a sample config file into a typed Dart settings class.
  • Generate a starting model with fromJson/toJson without typing every field by hand.
  • Document a third-party API response shape as Dart types.
  • Check which fields are optional before writing null-handling logic by hand.
  • Speed up adding a new Flutter model from sample JSON during prototyping.

Frequently Asked Questions

Last updated: 2026-07-23 · Reviewed by Nham Vu