JSON to Dart Converter
Generate null-safe Dart classes and JSON mapping functions, including nested objects, lists and nullable properties.
How to generate Dart models
Paste a representative JSON object or array, choose a root type name and run the generator. Use the file selector to inspect each source file; Copy copies only the selected file. Download ZIP keeps all generated files together. Original JSON field names are mapped in complete output even when they are language keywords or contain punctuation.
Complete output uses dart:convert and generated fromJson/toJson mappings; no code generation build step is needed. Models-only mode omits conversion functions. Dart compiled to JavaScript cannot exactly represent every signed 64-bit integer: use string IDs for values beyond the web runtime’s safe integer range.
Samples, optional fields and limits
For several responses of the same shape, select JSON Lines and put one JSON document on each line. Fields missing from some object samples become optional; an explicit null contributes a nullable type. Empty arrays and null-only fields do not contain enough evidence to infer a precise element or value type. Add representative samples and review the generated model.
String values stay strings, including numeric IDs, dates and UUIDs. This infers a model from examples, not a full API contract. Limits: 200,000 characters, 64 nesting levels, 50 sample documents, 50 generated files and 1,000,000 output characters. Processing runs locally in a cancellable worker with a 10-second deadline.
Questions & answers
Are missing fields the same as null?
No. Missing fields indicate optional membership; null is a value. The target language may represent both through an optional or nullable type. Provide multiple samples and use All fields optional only when that matches your application.
Does this fetch schemas or send JSON to an API?
No. Only the JSON samples you enter are used. No schema URLs or JSON strings are fetched, and the generated program is not executed on this page.