https://github.com/notbucai/json2dart
json 2 dart(serializable)
https://github.com/notbucai/json2dart
dart json serializable
Last synced: about 2 months ago
JSON representation
json 2 dart(serializable)
- Host: GitHub
- URL: https://github.com/notbucai/json2dart
- Owner: notbucai
- Created: 2023-11-11T01:51:24.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-19T13:39:01.000Z (over 2 years ago)
- Last Synced: 2025-01-23T08:42:40.710Z (over 1 year ago)
- Topics: dart, json, serializable
- Language: TypeScript
- Homepage: https://json2dart.vercel.app
- Size: 377 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JSON to Dart
地址:[https://json2dart.vercel.app/](https://json2dart.vercel.app/)
项目参考 [json2dart](https://github.com/caijinglong/json2dart) 进行优化。
## 优化内容
1. 界面
2. 更多配置项
3. 构造函数可选
4. 增加toString
## 生成内容参考
```dart
import 'package:json_annotation/json_annotation.dart';
part 'bucai_test_user_info_join.g.dart';
@JsonSerializable(explicitToJson: true)
class BucaiTestUserInfoJoin {
@JsonKey(name: 'request_id')
final String? requestId;
@JsonKey(name: 'message')
final String? message;
@JsonKey(name: 'status')
final int? status;
@JsonKey(name: 'n')
final dynamic? n;
@JsonKey(name: 'testArr')
final List? testArr;
@JsonKey(name: 'result')
final BucaiTestUserInfoJoinResult? result;
BucaiTestUserInfoJoin({
this.requestId,
this.message,
this.status,
this.n,
this.testArr,
this.result,
});
factory BucaiTestUserInfoJoin.fromJson(Map json) => _$BucaiTestUserInfoJoinFromJson(json);
Map toJson() => _$BucaiTestUserInfoJoinToJson(this);
@override
String toString() => toJson().toString();
}
```
## 如何开发
1. 下载项目
2. npm install
3. npm run dev