class UserProfile {
final int id;
final String name;
final bool active;
final double score;
const UserProfile({
required this.id,
required this.name,
required this.active,
required this.score,
});
factory UserProfile.fromJson(Map<String, dynamic> json) => UserProfile(
id: json['id'],
name: json['name'],
active: json['active'],
score: json['score'],
);
}JSON 转 Dart Model是 CLIS.CC 按常用在线工具使用习惯整理的小工具,适合在浏览器中快速完成数据格式化、编码解码、文本整理、配置转换、单位换算和代码片段生成。工具默认采用左侧输入、右侧输出的一屏结构,常用选项集中在输入区顶部,输入内容后会即时生成结果,不需要额外跳转页面,也不会打断原有编辑流程。
根据 JSON 示例生成 Dart 类字段和 fromJson。在实际使用中,你可以把接口返回、配置文件、URL 参数、文本列表或样式片段直接粘贴到输入区,再根据需要调整处理方式。右侧结果区保持纯文本展示,方便选择、滚动和复制,适合开发调试、运营整理、SEO 文案处理、文档排版和日常办公场景。