javiercbk / json_to_dart

Library that generates dart classes from json strings

Home Page:https://javiercbk.github.io/json_to_dart/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Give Option to make Json Serializable

pratikbutani opened this issue · comments

Greetings!

I have used this tool. It is very useful excepting some problems.

I am using json_serializable library for JSON Parsing. It is creating toJson and fromJson method itself, we just need to write their format.

Example :

import 'package:json_annotation/json_annotation.dart';

part 'example.g.dart';

@JsonSerializable(nullable: false)
class Person {
  final String firstName;
  final String lastName;
  final DateTime dateOfBirth;

  Person({this.firstName, this.lastName, this.dateOfBirth});

  factory Person.fromJson(Map<String, dynamic> json) => _$PersonFromJson(json);

  Map<String, dynamic> toJson() => _$PersonToJson(this);
}

Hope for best if you can also support this thing.

https://deploy-preview-3--dart-quicktype.netlify.app/

check out and drop a comment at chunlee-thong/dart-quicktype#3 and help it get merged by the author.