Developer Tools
JSON to Dart Converter
Paste JSON and get idiomatic Dart classes with fromJson, toJson, and optional copyWith. Supports manual, json_serializable, and freezed output styles.
Output options
Live preview updates with every change. Parsing and inference run in your browser; the JSON you paste is not uploaded.
Used as the name of the top-level class. Normalised to a valid PascalCase Dart identifier automatically.
Output style
Manual produces a standalone class with a hand-written fromJson and toJson; no pubspec changes needed. json_serializable emits the boilerplate read by build_runner with json_annotation. freezed produces an immutable union-style class wired up for both the freezed and json_serializable code generators.
Field modifier
final is idiomatic for DTOs and works with both json_serializable and freezed. Pick mutable only when you need to reassign fields in place. Ignored for freezed output, which is always immutable.
Indent
The Dart effective style guide and the official linter default to 2 spaces. Choose 4 only if your project already uses it.
How to use
- Paste a JSON value into the input panel. Objects, arrays of objects, or arrays of primitives are all supported.
- Pick an output style: Manual for a no-dependency class, json_serializable for build_runner codegen, or freezed for an immutable union-style model.
- Set the root class name; everything else, including PascalCase normalisation and reserved-word guards, runs automatically.
- Tune optional toggles like copyWith, toString, final fields, sort fields A to Z, and whether nullable fields should be marked required.
- Copy the generated Dart code into a .dart file. For json_serializable and freezed, run dart run build_runner build to produce the matching part files.
About this tool
JSON to Dart Converter parses any JSON value with the browser's native parser, walks the resulting tree to infer a structural schema, and emits idiomatic Dart classes for one of three output styles. Manual produces a standalone class with a const constructor, a fromJson factory that casts each JSON map entry to its Dart type, a toJson method that round-trips the original keys, and an optional copyWith helper. json_serializable produces a class annotated with @JsonSerializable, the matching factory and toJson boilerplate that build_runner expects, and the part directive for the generated .g.dart file. freezed produces an immutable union-style class with @freezed, a const factory constructor, and both the .freezed.dart and .g.dart part directives. Naming follows the official Dart style guide: PascalCase for class names, lowerCamelCase for fields, with snake_case JSON keys normalised automatically and reserved words guarded with a defensive suffix. JSON keys that do not round-trip cleanly to the Dart field name are annotated with @JsonKey(name: 'original_key') so wire payloads deserialize byte for byte. Integer JSON numbers map to int, fractional numbers to double, mixed and unknown values to dynamic, and arrays become List<T> with the element type inferred from every sample seen. Nested object shapes are promoted into their own named classes (Address, Geo, Score) so the output stays flat and easy to navigate in any IDE. Useful for Flutter teams converting REST and GraphQL responses, mobile API consumers building DTOs, and anyone who wants a fast, reproducible way to bootstrap Dart models from an existing JSON sample without copying a single line by hand. Parsing, schema inference, and code generation all run locally on your device, so the JSON you paste here is never uploaded.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
JSON to Kotlin Data Class Converter
Generate Kotlin data classes from JSON with kotlinx.serialization, Gson, or Moshi annotations.
Open tool
DeveloperJSON to TypeScript Converter
Generate TypeScript interfaces or types from any JSON value with full inference.
Open tool
DeveloperJSON to Python Converter
Generate a Python dict, dataclasses, or Pydantic models from any JSON value.
Open tool
DeveloperJSON to Go Struct Converter
Generate idiomatic Go structs with json tags from any JSON value.
Open tool
DeveloperJSON to C# Class Converter
Generate C# classes or records (System.Text.Json or Newtonsoft) from any JSON.
Open tool
DeveloperJSON Formatter
Format, minify, and validate JSON in your browser.
Open tool