class Nursery { int cropId; String executeDate; String description; String substrates; num quantity; num seedLength; num seedIncubationTime; List nurseryDetail; Nursery( {this.cropId, this.executeDate, this.description, this.substrates, this.quantity, this.seedLength, this.seedIncubationTime, this.nurseryDetail}); Nursery.fromJson(Map json) { cropId = json['cropId']; executeDate = json['executeDate']; description = json['description']; substrates = json['substrates']; quantity = json['quantity']; seedLength = json['seedLength']; seedIncubationTime = json['seedIncubationTime']; if (json['nurseryDetail'] != null) { nurseryDetail = new List(); json['nurseryDetail'].forEach((v) { nurseryDetail.add(new NurseryDetail.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); data['cropId'] = this.cropId; data['executeDate'] = this.executeDate; data['description'] = this.description; data['substrates'] = this.substrates; data['quantity'] = this.quantity; data['seedLength'] = this.seedLength; data['seedIncubationTime'] = this.seedIncubationTime; if (this.nurseryDetail != null) { data['nurseryDetail'] = this.nurseryDetail.map((v) => v.toJson()).toList(); } return data; } } class NurseryDetail { String workerName; String trayNumber; NurseryDetail({this.workerName, this.trayNumber}); NurseryDetail.fromJson(Map json) { workerName = json['workerName']; trayNumber = json['trayNumber']; } Map toJson() { final Map data = new Map(); data['workerName'] = this.workerName; data['trayNumber'] = this.trayNumber; return data; } }