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.
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 → TypeScript interfaces
ClientInterfaces from sample JSON—nested types and arrays inferred in the browser.
JSON formatter
ClientJSON format online: pretty-print, minify, validate, escape, download .json.
YAML ↔ JSON
ClientYAML to JSON and JSON to YAML online—format, validate, convert locally.