Data & JSON
JSON to Dart
Convert JSON to Dart classes with recursive nested types, List collections, merged array fields, nullable annotations, custom root class names and private fields. Runs locally in your browser.
About this tool
Paste a JSON sample to generate Dart class definitions. Nested objects become classes, arrays become List<T>, and fields are merged across array items for Flutter models, API data types and fixtures.
Null or missing fields become nullable. Integers, decimals, booleans and strings map to int, double, bool and String, while mixed types fall back to Object?.
Best use cases
- Turn JSON API responses into Dart or Flutter data models.
- Draft Dart DTOs, configuration models or test data structures.
- Review field types, collection shapes and nullability against a JSON sample.
How to use it
- Paste a JSON object or an array of objects; an example is available.
- Set the root class name and optionally enable private fields.
- Select Generate Dart, review the code, then copy or download the .dart file.
Scope and limits
- Up to 200,000 characters, 40 nesting levels and 20,000 nodes; the root must be an object or an array.
- Numbers use JavaScript precision. Represent integers beyond the safe range as strings.
- Types are inferred from the sample only. JSON serialization code is not generated; review before importing into a project.
Data processing
JSON parsing and Dart code generation run entirely in your browser. Nothing is uploaded or stored.
FAQ
How are inconsistent objects in an array handled?
Fields are merged across every array element. Fields missing from some items become nullable, numeric conflicts widen to double, and other type conflicts fall back to Object?.
What does private fields change?
Field names receive an underscore prefix, such as userName becoming _userName. Class constructors are updated to match the private field names.
Is my JSON uploaded?
No. Parsing and generation run locally in your browser, and input is not retained after you close the page.