JSON → Dart classes
ClientPaste JSON to get immutable classes with required constructor parameters—add fromJson or code generation when you wire json_serializable.
Learn more: JSON and Dart
Emit immutable classes with `final` fields and a required constructor—pair with json_serializable or hand-written fromJson for JSON.
Scope
Reserved Dart identifiers get a `Field` suffix; numbers use double. Flutter and server Dart share the same shape patterns.
JSON → Dart
?
Parses JSON in your browser and emits classes inferred from the sample shape. Nested objects become nested types; arrays use the first element only to guess item shape. Nothing is uploaded.
Add fromJson/toJson or json_serializable—this output is shape scaffolding only.
Nearby workflows on Toolcore
- JSON formatter — when the sample still needs strict parse before you trust the inference.
- JSON → Swift — for another mobile client language from the same API sample.
- Compare JSON — after you change the sample and want to see structural drift.
Common use cases
- Draft immutable classes for Flutter apps or server Dart before wiring json_serializable.
- Compare API field names with Dart naming conventions and required vs optional parameters.
- Share a quick model shape in mobile PRs when the backend ships sample JSON.
Common mistakes to avoid
Skipping null-safety on fields that can be absent
Mark nullable types when responses vary; a single happy-path sample may hide nulls.
Forgetting Equatable or freezed when you need value equality
Generated classes are structural; add codegen packages when you rely on equality or unions.
FAQ
Is Dart code generated locally?
Yes. Inference runs in your browser tab.
Does this emit fromJson / toJson?
It focuses on class fields. Add json_serializable or manual mappers for serialization.
More tools
Related utilities you can open in another tab—mostly client-side.
JSON → Swift structs (Codable)
ClientSwift structs with Codable and CodingKeys from sample JSON—local only.
JSON → Nim types
ClientNim object types from sample JSON—snake_case fields, seq for arrays, browser-side.
JSON → Scala case classes
Clientfinal case class scaffolding from sample JSON—Seq types, local only.
YAML ↔ JSON
ClientYAML to JSON and JSON to YAML online—bidirectional converter, format either side in the browser.