Dev Utilities

JSON to Dart

Convert JSON into a proper Dart model class: real field types, null safety, and fromJson/toJson methods, generated automatically. Paste a single sample object, or an array of several samples, and the tool infers which fields are ever missing or null across your samples and marks only those as nullable. Nested objects and lists of objects each get their own generated class.

  • Files never leave your device
  • Runs entirely in your browser
  • Free, no account needed
Use JSON to Dart - free

How to use JSON to Dart

  1. 1

    Open JSON to Dart

    Go to tools.slaytic.com and open the JSON to Dart tool. No sign-up or account required.

  2. 2

    Paste your JSON and name the class

    Paste one JSON object, or an array of sample objects, and set the root class name.

  3. 3

    Copy or download your Dart model

    Click Generate to get a complete Dart file with typed fields, a constructor, and fromJson/toJson. Copy it or download it as a .dart file.

How this works in your browser

This tool infers a schema from your JSON directly in your browser, no external Dart tooling or build_runner involved. It walks every sample you provide, merges the shape of each field across all of them, and marks a field nullable only if it was ever missing or null in at least one sample. Nested objects and lists of objects each become their own generated class, and the output is plain, dependency-free Dart you can paste straight into a project.

JSON to Dart vs. traditional online converters

FeatureJSON to Dart (in-browser)Traditional online converters
File upload requiredNo - never leaves your deviceYes - file is sent to a server
Processing queueNone - starts instantlyOften, especially at peak times
Watermark on outputNeverCommon on free plans
Usage limitsNone - free, unlimited useOften capped per day or file size
Works offline once loadedYes, for most toolsNo - requires a live connection
Account requiredNoOften, for anything beyond a trial

Who uses JSON to Dart

Flutter and Dart developers

Turn a sample API response into a working model class in seconds, instead of hand-writing fields and a fromJson parser.

Prototyping against a real API

Paste a real response from the API you are integrating with and get types that actually match the data, not a guess.

Catching optional fields early

Paste a few different real samples from the same endpoint to see exactly which fields are sometimes missing, so your model marks them nullable instead of crashing on the one response that omits one.

Frequently asked questions

Is this JSON to Dart converter free?

Yes, completely free with no limit on how many times you use it.

Will the generated Dart actually compile?

Yes, for typical JSON shapes: it produces null-safe fields, a constructor, and matching fromJson/toJson methods with no external package required. Very irregular or deeply mixed-type data may need a small manual touch-up.

How does it decide if a field is nullable?

If you paste an array of sample objects, a field is marked nullable if it was missing or null in any one of them. With a single object, a field is only nullable if its value is literally null.

What happens with nested objects and lists?

Each nested object, and each list of objects, gets its own generated Dart class with its own fromJson/toJson, referenced from the parent class.

What if a field has mixed types across samples?

A field that is sometimes a number and sometimes a string, for example, is typed as dynamic rather than guessing one type that could fail to compile against real data.

Is my JSON sent anywhere?

No, the entire conversion runs inside your browser.

Generate a Dart model from JSON - free and instant.

Open JSON to Dart
  • Files never leave your device
  • No upload required
  • No account needed
  • Unlimited use, always free